#34055 [Opn->Fbk]: Odd exception in strtotime parsing

From: Date: Tue, 09 Aug 2005 20:11:20 +0000
Subject: #34055 [Opn->Fbk]: Odd exception in strtotime parsing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-83263@lists.php.net to get a copy of this message
ID: 34055 Updated by: tony2001@php.net Reported By: markjreed at mail dot com -Status: Open +Status: Feedback Bug Type: Date/time related Operating System: Any PHP Version: 5.0.3 New Comment: 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. Thanks. Previous Comments: ------------------------------------------------------------------------ [2005-08-09 20:37:52] 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 20:34:51] 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:05:06] tony2001@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-08-09 19:56:06] markjreed at mail dot com Description: ------------ 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34055&edit=1

« previous php.bugs (#83263) next »