php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28951 strtotime bad dates for "Jan 2002"
Submitted: 2004-06-28 19:50 UTC Modified: 2004-07-06 15:42 UTC
From: foxyshadis1 at dslextreme dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.7 OS: Win2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: foxyshadis1 at dslextreme dot com
New email:
PHP Version: OS:

 

 [2004-06-28 19:50 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-29 00:16 UTC] 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-29 08:58 UTC] derick@php.net
It returns the expected result "29 May 2004" to me.
 [2004-06-29 09:02 UTC] foxyshadis1 at dslextreme dot com
Is this with the win32 version? There may be a discrepancy.
 [2004-07-06 15:42 UTC] 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-07-06 15:42 UTC] 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.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 11 17:02:22 2024 UTC