| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2003-01-30 12:40 UTC] david at sxsw dot com
 #!/usr/bin/php -q
<?
system("cat test");
for($x=1; $x<=12; $x++) {
    echo "$x = ".date("m", mktime(0,0,0,$x))."\n";
}
?>
1 = 01
2 = 03
3 = 03
4 = 04
5 = 05
6 = 06
7 = 07
8 = 08
9 = 09
10 = 10
11 = 11
12 = 12
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 03:00:01 2025 UTC | 
See what you get if you use the "r" format: # php -r 'for($x=1; $x<=3; $x++) { echo "$x = ".date("r", mktime(0,0,0,$x))."\n"; }' 1 = Thu, 30 Jan 2003 00:00:00 +0100 2 = Sun, 2 Mar 2003 00:00:00 +0100 3 = Sun, 30 Mar 2003 00:00:00 +0100 So apparently the "February, 30th" is turned into its normal representation by mktime(). Although that doesn't seem to be documented, I think that's a feature, because it helps doing date calculations.This bug does exist in 4.3.4 running on Mac OS X 10.2.8. It is directly related to the daylight saving time changeover date (28 March 2004 in the UK). I recreate it using: <?php { echo '<p>27/3/04 = ' . strval(mktime(00,0,0,3,27,2004)) . '</p>'; // 1080345600 echo '<p>28/3/04 = ' . strval(mktime(0,0,0,3,28,2004)) . '</p>'; // -3662 - should be 108042840 echo '<p>28/3/04 = ' . strval(mktime(2,0,0,3,28,2004)) . '</p>'; // 1080435600 echo '<p>29/3/04 = ' . strval(mktime(0,0,0,3,29,2004)) . '</p>'; // 1080514800 echo '<p>30/3/04 = ' . strval(mktime(0,0,0,3,30,2004)) . '</p>'; // 1080601200 } ?> On the changeover date, times between midnight and 2 am exhibit the bug. Times from 2 am onwards are correct. I haven't checked, but I would bet the date in the original bug report was the DST changeover date for the locale of the person who submitted it.