|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-11-21 03:04 UTC] danielc@php.net
[2011-11-21 03:04 UTC] danielc@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: danielc
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 11:00:01 2025 UTC |
Description: ------------ Relative date/time format '+[number]sec', '+[number]min', '+[number]hour' returns incorrect time when the current time is in daylight saving time and the result of calculation is non-daylight saving time. For example, daylight saving time of this year in the USA was started at 2010-03-14 02:00:00, and finished at 2010-11-07 02:00:00. However, '2010-11-07 01:59:59 +1sec' advance to 3601 sec after. Test script: --------------- <?php date_default_timezone_set('America/Los_Angeles'); echo date("c", strtotime("2010-03-14 01:59:59")) . PHP_EOL; echo date("c", strtotime("2010-03-14 01:59:59 +1sec")) . PHP_EOL; echo date("c", strtotime("2010-11-07 01:59:59")) . PHP_EOL; echo date("c", strtotime("2010-11-07 01:59:59 +1sec")) . PHP_EOL; Expected result: ---------------- 2010-03-14T01:59:59-08:00 2010-03-14T03:00:00-07:00 2010-11-07T01:59:59-07:00 2010-11-07T01:00:00-08:00 Actual result: -------------- 2010-03-14T01:59:59-08:00 2010-03-14T03:00:00-07:00 2010-11-07T01:59:59-07:00 2010-11-07T02:00:00-08:00