#45509 [Opn->Asn]: create_date_from_format cannot parse negative (BC) dates
| From: | derick@php.net | Date: | Mon, 14 Jul 2008 13:34:01 +0000 |
| Subject: | #45509 [Opn->Asn]: create_date_from_format cannot parse negative (BC) dates | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126666@lists.php.net to get a copy of this message | ||
ID: 45509
Updated by: derick@php.net
Reported By: tj at systisoft dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Mac OS X
PHP Version: 5.3CVS-2008-07-14 (CVS)
-Assigned To:
+Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2008-07-14 13:29:21] tj at systisoft dot com
Description:
------------
While the constructor of DateTime can handle negaive dates (BC dates),
create_date_from_format cannot.
Reproduce code:
---------------
$d = new DateTime("-4000-01-31"); echo $d->format("Y-m-d"), PHP_EOL;
$d = date_create_from_format("Y-m-d", "4000-01-31"); echo
$d->format("Y-m-d"), PHP_EOL;
$d = date_create_from_format("Y-m-d", "-4000-01-31"); echo
$d->format("Y-m-d"), PHP_EOL;
Expected result:
----------------
-4000-01-31
4000-01-31
-4000-01-31
Actual result:
--------------
-4000-01-31
4000-01-31
PHP Fatal error: Call to a member function format() on a non-object in
Command line code on line 3
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45509&edit=1