|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34055 Odd exception in strtotime parsing
Submitted: 2005-08-09 19:56 UTC Modified: 2005-08-17 01:00 UTC
From: markjreed at mail dot com Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 5.0.3 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
42 + 49 = ?
Subscribe to this entry?

 [2005-08-09 19:56 UTC] markjreed at mail dot com
This doesn't seem to fall into the same category as the other strtotime() bugs I found in the system.  Here is an example:

$ php -r 'echo strftime("%c\n", strtotime("0900 tomorrow"));'
Sat Jan 26 13:50:04 2008

If I add a colon to the time ("09:00 tomorrow"), or exchange the date and time ("tomorrow 0900"), it produces the expected result. I don't know quite what's going on here.  Note that Perl's Time::ParseDate::parsedate function handles such strings properly.

The expected and actual output below are only for the particular moment when I tried it; they will vary depending on the time of the test.

Reproduce code:
echo strftime("%c\n", strtotime("0900 tomorrow"));

Expected result:
Wed Aug 10 09:00:00 2005

Actual result:
Sat Jan 26 13:50:04 2008


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-09 20:05 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-08-09 20:34 UTC] markjreed at mail dot com
The latest CVS snapshot (200508091630) handles the problem string better, but still not perfectly - it gets the date right but ignores the hour:

$ ./sapi/cli/php -r 'echo strftime("%c\n", strtotime("0900 tomorrow"));'
Wed Aug 10 00:00:00 2005
 [2005-08-09 20:37 UTC] markjreed at mail dot com
The latest snapshot also ignores the time in the colon'ed version ("09:00 tomorrow"), whereas 5.0.3 got that right:

$ php -r 'echo strftime("%c\n", strtotime("09:00 tomorrow"));' #5.0.3
Wed Aug 10 09:00:00 2005
$ ./sapi/cli/php -r 'echo strftime("%c\n", strtotime("09:00 tomorrow"));' #200508091630
Wed Aug 10 00:00:00 2005
 [2005-08-09 22:11 UTC]
Snapshots have been already fixed (but you might have to wait for the next one).
Please use this system to reply/comment and not the e-mail.
 [2005-08-17 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jul 25 00:01:23 2021 UTC