note 47934 deleted from function.strtotime by derick

From: Date: Sun, 15 Jul 2007 12:51:08 +0000
Subject: note 47934 deleted from function.strtotime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128593@lists.php.net to get a copy of this message
Note Submitter: Dot_Whut? ---- I'm not so sure the following claim (taken from above) is true in all cases: $date_time2 = strtotime("2004-04-04 02:00:00 GMT"); // works great! When I try this (on a server that acknowledges Pacific Daylight Savings Time): echo date('Y-m-d H:i:s'. $date_time2); I get: 2004-04-03 17:00:00 which is incorrect. It should be 18:00 hours, the day prior. It would appear that although GMT (or UTC or even Z) is specified in the time string, the date is treated as if a Daylight Savings Time switch should apply when it shouldn't. Try this (only if your server would acknowledge PST/PDT in North America)... // In Greenwich (UTC) at 2:00 AM on the first Sunday in April, // it is NOT Daylight Savings Time ANYWHERE in North America $std_time = strtotime('2004-04-04 01:59:59 UTC'); $std_time = strtotime('2004-04-04 02:00:00 UTC'); echo 'Standard Time: ' . date('Y-m-d H:i:s', $std_time) . '<br />'; echo 'Daylight Savings: ' . date('Y-m-d H:i:s', $dst_time) . '<br />'; Emits: Standard Time: 2004-04-03 17:59:59 Daylight Savings: 2004-04-03 17:00:00 Which is totally incorrect. Why does should the clock "fall" backward anyways? I thought the rule was "spring" forward. The following example does work properly as expected: // In Greenwich (UTC) at 10:00 AM on the first Sunday in April, // it is Daylight Savings Time in most of North America // For Mountain 08:59, Central 07:59, Eastern 06:59, Atlantic 05:59 $std_time = strtotime('2004-04-04 09:59:59 UTC'); // For Mountain 9:00, Central 08:00, Eastern 07:00, Atlantic 06:00 $dst_time = strtotime('2004-04-04 10:00:00 UTC'); echo 'Standard Time: ' . date('Y-m-d H:i:s', $std_time) . '<br />'; echo 'Daylight Savings: ' . date('Y-m-d H:i:s', $dst_time) . '<br />'; Which emits: Standard Time: 2004-04-04 01:59:59 Daylight Savings: 2004-04-04 03:00:00 Which is correct...

« previous php.notes (#128593) next »