mktime and date questions..
- by mjboggess
Hello SO! I am working on a small project and am playing with date() and mktime() in PHP. Compare the two code blocks and their output, notice the second sample adds one to the month in it's first mktime.
$monthis = 5;
echo date('F', mktime(0,0,0,$monthis,0,0)) . " 1, 2010 is on a " . date("l F", mktime(0, 0, 0, $monthis, 1, 2010));
puts out
April 1, 2010 is on a Saturday May
but if I change it to
$monthis = 5;
echo date('F', mktime(0,0,0,$monthis + 1,0,0)) . " 1, 2010 is on a " . date("l F", mktime(0, 0, 0, $monthis, 1, 2010));
puts out
May 1, 2010 is on a Saturday May
Why do I have to add one to the month in the first mktime so that both emit the same month?
Any help or clarity would be appreciated. Thanks :)