On my page: http://www.newton-poppleford-weather.co ... ecords.php
I've currently got this error.
Warning: printf() [function.printf]: Too few arguments in /home/newtonpo/public_html/wxrecords.php on line 74
I'm not sure what that means. I'm trying to do the same as I did before with the month gust on the ajax-dashboard.php, but it just won't work!
Here is my code:
Code: Select all
<?php printf('%02d/%02d',recordsbegandate); ?>
Or, has it got to do with this code?
Code: Select all
<?php
function fix_CU_record_date( $inDate) {
global $SITE;
$EnglishMonths = array(
'January','February','March','April','May','June',
'July','August','September','October','November','December');
// 'at 2:45 PM on 16 October 2009'
if(preg_match('|at (.*) on (.*)$|',$inDate,$matches)) {
echo "<!-- inDate='$inDate' date='".$matches[2]."' time='".$matches[1]."' -->\n";
$rdate = $matches[2];
if (isset($SITE['monthNames'])) {
// convert TO English for strtotime()
foreach ($EnglishMonths as $i => $monthEN) {
$rdate = preg_replace('|'.$SITE['monthNames'][$i].'|i',$monthEN,$rdate);
}
}
$t = strtotime($rdate . ' ' .$matches[1]);
$outTime = date($SITE['dateOnlyFormat'] . ' ' .$SITE['timeOnlyFormat'],$t);
if (isset($SITE['langMonths'])) {
// convert From English for return (will only work if long-format month names in $timeFormat)
foreach ($EnglishMonths as $i => $monthEN) {
$outTime = preg_replace('|'.$monthEN.'|i',$SITE['langMonths'][$i],$outTime);
}
}
echo "<!-- outTime='$outTime' -->\n";
return($outTime);
}
if(preg_match('|on (.*)$|',$inDate,$matches)) {
echo "<!-- inDate='$inDate' date='".$matches[1]."' -->\n";
$rdate = $matches[1];
if (isset($SITE['monthNames'])) {
// convert TO English for strtotime()
foreach ($EnglishMonths as $i => $monthEN) {
$rdate = preg_replace('|'.$SITE['monthNames'][$i].'|i',$monthEN,$rdate);
}
}
$t = strtotime($rdate);
$outTime = date($SITE['dateOnlyFormat'],$t);
if (isset($SITE['langMonths'])) {
// convert From English for return (will only work if long-format month names in $timeFormat)
foreach ($EnglishMonths as $i => $monthEN) {
$outTime = preg_replace('|'.$monthEN.'|i',$SITE['langMonths'][$i],$outTime);
}
}
echo "<!-- outTime='$outTime' -->\n";
return($outTime);
}
if(preg_match('|(\S+) (\d+)$|',$inDate,$matches)) {
echo "<!-- inDate='$inDate' month='".$matches[1]."' year='".$matches[2]."' -->\n";
$rdate = $matches[1];
if (isset($SITE['monthNames'])) {
// convert TO English for strtotime()
foreach ($EnglishMonths as $i => $monthEN) {
$rdate = preg_replace('|'.$SITE['monthNames'][$i].'|i',$monthEN,$rdate);
}
}
$t = strtotime($rdate . ' ' . $matches[2]);
$idx = date('n',$t); // month number 1=january etc...
$outTime = $SITE['langMonths'][$idx-1] . ' ' . $matches[2];
echo "<!-- outTime='$outTime' -->\n";
return($outTime);
}
return(trim($inDate));
}
Thanks
William