#28951 [Bgs]: strtotime bad dates for "Jan 2002"
| From: | sniper@php.net | Date: | Tue, 06 Jul 2004 13:42:27 +0000 |
| Subject: | #28951 [Bgs]: strtotime bad dates for "Jan 2002" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61781@lists.php.net to get a copy of this message | ||
ID: 28951
Updated by: sniper@php.net
Reported By: foxyshadis1 at dslextreme dot com
Status: Bogus
Bug Type: Date/time related
Operating System: Win2000
PHP Version: 4.3.7
New Comment:
strtotime is sort of 'fuzzy' function. Do not pass just anything to
it..as you'll get out just about anything then.
Previous Comments:
------------------------------------------------------------------------
[2004-07-06 15:42:23] sniper@php.net
strtotime is sort of 'fuzzy' function. Do not pass just anything to
it..as you'll get out just about anything then.
------------------------------------------------------------------------
[2004-06-29 09:02:45] foxyshadis1 at dslextreme dot com
Is this with the win32 version? There may be a discrepancy.
------------------------------------------------------------------------
[2004-06-29 08:58:43] derick@php.net
It returns the expected result "29 May 2004" to me.
------------------------------------------------------------------------
[2004-06-29 00:16:21] no dot email at nowhere dot com dot invalid
strtotime /is/ parsing correctly, it is treating it as Month Day.
2001st of May 2004 = 22nd October 2009. Pass a day to avoid confusion.
------------------------------------------------------------------------
[2004-06-28 19:50:02] foxyshadis1 at dslextreme dot com
Description:
------------
strtotime is attempting and failing to read dates in a "month year"
format. Both long and short months are affected. It is then returning
wildly wrong timestamps. Since the date cannot be correctly parsed, it
should return -1, or be modified to correctly parse it.
Reproduce code:
---------------
echo date("j M Y",strtotime("May 2001"));
Expected result:
----------------
1 May 2001
or
1 January 1969
Actual result:
--------------
22 Oct 2009
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28951&edit=1