|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-04-03 09:08 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 10:00:01 2025 UTC |
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.