ID: 27780 Updated by: [EMAIL PROTECTED] -Summary: strtotime(+1 xxx) returns 1 more hours Reported By: Hua dot Qu at volvo dot com -Status: Closed +Status: Open Bug Type: Date/time related -Operating System: Windows 2000 +Operating System: Windows 2000, Cygwin -PHP Version: 4.3.4 +PHP Version: 4.3.4, 5.1.0RC3 New Comment:
This reoccurs with 5.1.0RC3 on Cygwin. The test expects 1076824799 [2004-02-14 23:59:59 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds] but the result is 1076824799 [2004-02-14 23:59:59 GMT] [2004-04-07 00:00:00 -2 months +7 days +23 hour s +59 minutes +59 seconds] I suppose, the test case is broken here. Previous Comments: ------------------------------------------------------------------------ [2004-06-03 11:06:17] neilus at dcs dot kcl dot ac dot uk this is re-occurring in the 4.3 tests, so either the test or bug needs to be fixed ------------------------------------------------------------------------ [2004-04-01 15:38:33] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Please test the snapshot (in 4 hours)! ------------------------------------------------------------------------ [2004-03-31 02:56:20] [EMAIL PROTECTED] Right, this is a valid bug. ------------------------------------------------------------------------ [2004-03-31 02:41:03] Hua dot Qu at volvo dot com Thank you for quickly reply. I still consider it as a bug. If I set $to = 2004-03-28 00:00:00 $march0 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to")); $march1 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 second")); $march2 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 day ")); $march1 gives the correct result, while $march2 gives the wrong result. Because during the midnight of 28th it changed from the wintertime to the summertime for daylight saving. As you pointed out, to add a timezone: $to = "2004-03-28 00:00:00 WET"; $march0 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to")); $march1 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 seconds ")); $march2 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 day ")); Relative to $march0, $march1 gives the correct output, but these two outputs are not what I expected. $march2 is still totally wrong no matter reference to which dates. The point is, I think, PHP checks the output result with for daylight saving, but not the original input date. Regards, Hua Qu ------------------------------------------------------------------------ [2004-03-30 12:12:55] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You need to add timezone information to the original date. For example change your text time to "2004-06-01 00:00:00 EST". The end result will be that strtotime($to) will be 1 smaller then strtotime("$to +1 seconds "), which is the correct output. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/27780 -- Edit this bug report at http://bugs.php.net/?id=27780&edit=1