#37514 [Opn->Asn]: strtotime doesn't assume year correctly
| From: | tony2001@php.net | Date: | Thu, 18 May 2006 22:45:06 +0000 |
| Subject: | #37514 [Opn->Asn]: strtotime doesn't assume year correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97350@lists.php.net to get a copy of this message | ||
ID: 37514
Updated by: tony2001@php.net
Reported By: pcavit at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: FreeBSD 6
PHP Version: 5.1.4
-Assigned To:
+Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2006-05-18 22:43:03] pcavit at gmail dot com
Description:
------------
When using strtotime to parse dates if an 'am' or 'pm' is added without
specifying a year false will be returned.
Reproduce code:
---------------
echo date('r', strtotime('May 18th 5:05'));
echo date('r', strtotime('May 18th 5:05pm'));
echo date('r', strtotime('May 18th 5:05 pm'));
echo date('r', strtotime('May 18th 5:05am'));
echo date('r', strtotime('May 18th 5:05 am'));
echo date('r', strtotime('May 18th 2006 5:05pm'));
Expected result:
----------------
Thu, 18 May 2006 05:05:00 -0700
Thu, 18 May 2006 17:05:00 -0700
Thu, 18 May 2006 17:05:00 -0700
Thu, 18 May 2006 05:05:00 -0700
Thu, 18 May 2006 05:05:00 -0700
Thu, 18 May 2006 17:05:00 -0700
Actual result:
--------------
Thu, 18 May 2006 05:05:00 -0700
Wed, 31 Dec 1969 16:00:00 -0800
Wed, 31 Dec 1969 16:00:00 -0800
Wed, 31 Dec 1969 16:00:00 -0800
Wed, 31 Dec 1969 16:00:00 -0800
Thu, 18 May 2006 17:05:00 -0700
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37514&edit=1