ID: 32555 Comment by: web-php-bugs at sklar dot com Reported By: stickman at gmail dot com Status: Assigned Bug Type: Date/time related Operating System: FreeBSD 4.9 PHP Version: 4.3.10 Assigned To: derick New Comment:
With PHP 4.3.9, 5.0.3, and a recent CVS checkout, the following script (run in timezone US/Eastern): <?php $stamp = 1112427000; print strftime('%c',strtotime('now',$stamp)) ."\n"; print strftime('%c',strtotime('tomorrow',$stamp)) ."\n"; ?> produces: Sat Apr 2 02:30:00 2005 Sun Apr 3 03:30:00 2005 Which seems like a reasonable way for strtotime() to behave when it's called without a starting timestamp during the period that's less than 24 hours but more than 23 hours before a change to DST in a DST-respecting locale. That is, report the local time that corresponds to 86400 seconds after strtotime() is called. Previous Comments: ------------------------------------------------------------------------ [2005-04-05 22:31:29] [EMAIL PROTECTED] I know about DST and stuff - i was just wondering what tomorrow should do for 2.30am on the day before DST changes... that's not in the RFC ;-) ------------------------------------------------------------------------ [2005-04-03 18:17:28] stickman at gmail dot com Is there some kind of RFC for this? There's one for everything down to slicing bread. RFC 3339 - Date and Time on the Internet: Timestamps The UTC time corresponding to 17:00 on 23rd March 2005 in New York may depend on administrative decisions about daylight savings time. This specification steers well clear of such considerations.) No wonder they do. Daylight Saving Time is scary. It starts at 1:59am and hops ahead one hour and one minute to 3am. It's at different times across the world (12:59am Western Europe, 1:59am US, 2:59am Eastern Europe, different for every area of Russia). Arizona and Hawaii don't have it, Indiana sort of has it, and it's on a different day every year and different days across the world. Good luck, sir. ------------------------------------------------------------------------ [2005-04-03 15:58:28] [EMAIL PROTECTED] Correct. Although I'm not totally sure what "tomorrow" should do here then... ------------------------------------------------------------------------ [2005-04-03 09:17:15] stickman at gmail dot com Well duh. I didn't even notice but daylight savings is about that time. Could it be that "tomorrow" didn't exist for an hour? ------------------------------------------------------------------------ [2005-04-03 09:08:42] stickman at gmail dot com Description: ------------ Early morning on April 2nd, 2005 my website broke. I tracked it down to strtotime("tomorrow") returning -1 instead of the expected "tomorrow" timestamp. strtotime("today") worked fine. Asked a friend to test strtotime("tomorrow") and it worked fine for him on his server (set to a different time). Tested strtotime("tomorrow") on another server, also on Pacific time, and got false again. Went to bed to deal with it in the morning and the problem had resolved itself sometime between midnight and 7am. Reproduce code: --------------- #Run this code on April 2nd, sometime after midnight. echo strtotime("tomorrow"); Expected result: ---------------- 1112628800 (or thereabouts) Actual result: -------------- -1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32555&edit=1