|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-04-07 14:25 UTC] derick@php.net
[2004-04-12 18:18 UTC] cryogen at mac dot com
[2004-04-12 18:30 UTC] sniper@php.net
[2004-04-18 22:49 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ MacOSX 10.3.3 - PHP 4.3.4 (entropy.ch), California PST I searched through the existing bug submissions, but did not find anyone reporting this specific problem on Mac OSX, so here it is. I am using dates stored as GMT dates in order to provide my users across the world with accurate date- times in their local time zones (using timezone offsets to GMT). During the changover to daylight savings time on April 4, 2004 I ran into what I think is a bug with gmmktime(). Here is the code snippet: Reproduce code: --------------- <?php $td = gmmktime(2,0,0,4,4,2004); echo "<p>April 4, 2004 - 02:00 am<br/>"; echo "GMDATE = ".gmdate("m/d/Y H:i:s (g:i a)",$td)."<br/>"; echo "DATE = ".date("m/d/Y H:i:s (g:i a)",$td)."<br/>"; ?> Expected result: ---------------- What I expected to see for the GMDATE result was the same date I input in gmmktime() - "04/04/2004 02:00:00 (02:00 am)". Actual result: -------------- What I am actually getting is: "GMDATE = 12/31/1969 16: 58:58 (4:58 pm)", or an invalid result. Since gmmktime() is supposed to take GMT date input parameters as per the documentation, 2:00 am on April 4th is valid, since GMT does not have daylight savings time and should not have any code to deal with DST. It seems like it is behaving the same as mktime() which does not deal with the one hour we "spring forward" during daylight savings time (that hour essentially does not exist). NOTE#1: I tested this on Windows XP with PHP 4.3.4, Pacific time zone and got the result "04/04/2004 01:00:00 (01:00 am)" which is better, but still wrong. since gmmktime should not adjust the time at all for GMT, especially not in the wrong direction!. NOTE #2: I also tested this on Solaris with PHP 4.3.4, Pacific time zone and got the same result as Windows of 04/04/2004 01:00:00 (01:00 am). NOTE #3: I also tested this on Redhat 9.0, PHP 4.3.6 in Central Standard Time and got a result of 04/04/2004 03: 00:00 (03:00 am)? This one seems to be adjusting for DST (although it should be 4:00am) even though it should not. NOTE #4: I also tested this on a Redhat Linux Machine (v.9.0 PHP 4.3.4 Mountain Standard Time) and got the correct result of "04/04/2004 02:00:00 (02:00am)", although I fear this is because of the time being set to 01:00am and then adjusted to 2:00am for DST Mountain time (again, wrong).