From:             neil dot walker at syntegra dot com
Operating system: any
PHP version:      Irrelevant
PHP Bug Type:     Date/time related
Bug description:  mktime does not work when DST kicks in

Description:
------------
Hello,



The following code



Code:



<?php

   $n=date("w",mktime(0,0,0,3,29,2004));

   echo "<pre>";

   for($i=1;$i<32;$i++)

   {

      $d=date("D dS M Y",mktime(0,0,0,3,$i,2004));

      $n=date("w",mktime(0,0,0,3,$i,2004));

      echo $d,": day of week is $n<br />";

   }

   echo "</pre>";

?>





Outputs the details of March this year. Look at 28th March. It thinks it’s
the 27th! Now I know this is the change to daylight saving but mktime says
all should be well! However, if I change the hour to be 12 (right smack in
the middle) it gets the week day right (0 and not 6) but it still thinks
its Saturday.  I'm in the UK and the clocks changed on this day.





Mon 01st Mar 2004: day of week is 1

Tue 02nd Mar 2004: day of week is 2

Wed 03rd Mar 2004: day of week is 3

Thu 04th Mar 2004: day of week is 4

Fri 05th Mar 2004: day of week is 5

Sat 06th Mar 2004: day of week is 6

Sun 07th Mar 2004: day of week is 0

Mon 08th Mar 2004: day of week is 1

Tue 09th Mar 2004: day of week is 2

Wed 10th Mar 2004: day of week is 3

Thu 11th Mar 2004: day of week is 4

Fri 12th Mar 2004: day of week is 5

Sat 13th Mar 2004: day of week is 6

Sun 14th Mar 2004: day of week is 0

Mon 15th Mar 2004: day of week is 1

Tue 16th Mar 2004: day of week is 2

Wed 17th Mar 2004: day of week is 3

Thu 18th Mar 2004: day of week is 4

Fri 19th Mar 2004: day of week is 5

Sat 20th Mar 2004: day of week is 6

Sun 21st Mar 2004: day of week is 0

Mon 22nd Mar 2004: day of week is 1

Tue 23rd Mar 2004: day of week is 2

Wed 24th Mar 2004: day of week is 3

Thu 25th Mar 2004: day of week is 4

Fri 26th Mar 2004: day of week is 5

Sat 27th Mar 2004: day of week is 6

Sat 27th Mar 2004: day of week is 6

Mon 29th Mar 2004: day of week is 1

Tue 30th Mar 2004: day of week is 2

Wed 31st Mar 2004: day of week is 3





Reproduce code:
---------------
<?php

   $n=date("w",mktime(0,0,0,3,29,2004));

   echo "<pre>";

   for($i=1;$i<32;$i++)

   {

      $d=date("D dS M Y",mktime(0,0,0,3,$i,2004));

      $n=date("w",mktime(0,0,0,3,$i,2004));

      echo $d,": day of week is $n<br />";

   }

   echo "</pre>";

?>



Expected result:
----------------
the correct dates, refer to description

Actual result:
--------------
the wrong dates. refer to description

-- 
Edit bug report at http://bugs.php.net/?id=27852&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27852&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27852&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27852&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27852&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27852&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27852&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27852&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27852&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27852&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27852&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27852&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27852&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27852&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27852&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27852&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27852&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27852&r=float

Reply via email to