php date() problems ... again
Posted: Wed Mar 31, 2010 9:19 am
What is going on here? This was just a quick fix to apply a date label to a document ... it worked fine until today, the last day of the month. I thought php takes the local machine's time zone, so I doubt it's that kind of error. Any explanations?
It currently outputs:
Code: Select all
$thismonth = date("m");
$f_thismonth = date("F");
$thisday = date("d");
$nextmonth = date("m",mktime(0,0,0,date("m")+1,date("d"),date("y")));
$f_nextmonth = date("F",mktime(0,0,0,date("m")+1,date("d"),date("y")));
$monthafter = date("m",mktime(0,0,0,date("m")+2,date("d"),date("y")));
$f_monthafter = date("F",mktime(0,0,0,date("m")+2,date("d"),date("y")));
echo "Today's date: " . $thismonth . " " . $thisday . "<p>";
echo "Next month: " . $f_nextmonth . " " . $nextmonth . "<p>";
echo "Month after: " . $f_monthafter . " " . $monthafter;
?>
It currently outputs:
Today's date: 03 31
Next month: May 05
Month after: May 05