|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45647 strtotime() returning 1999-11-30 for 00-00-00 00:00:00
Submitted: 2008-07-28 16:40 UTC Modified: 2008-07-28 19:17 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jon dot reed at jellyfish dot co dot uk Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.6 OS: Centos 5.1
Private report: No CVE-ID:
 [2008-07-28 16:40 UTC] jon dot reed at jellyfish dot co dot uk
As per bug #41523 which is reported fixed on Vista.

We're running a custom build RPM of 5.2.6
It looks like this bug has reappeared:

$incorrect = '1999-11-30';
$time = date('Y-m-d',strtotime('00-00-00 00:00:00')); 
$this->assertNotEqual($time, $incorrect);

This fails SimpleTest.

php -r "echo date('Y-m-d',strtotime('00-00-00 00:00:00'));"

Reproduce code:
echo strtotime('00-00-00 00:00:00');

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-28 19:17 UTC]
There is no bug here, 00-00-00 means 2000-00-00, which is 1999-12-00, which is 1999-11-30. No bug, perfectly normal.
 [2016-01-23 10:18 UTC] senz at senz dot su
@Derick, you are inconsistent with your opinion: and your logic is not obvious for end user, nor properly documented.
Also look at this comment 
IMHO year 0 should be considered as error, as in previous versions. Since this is BC issue. Alto this case is rare, but very misleading for inexperienced developer, when one's dev and production archs differs.
 [2016-01-27 18:33 UTC] me at navarr dot me
@senz  It is consistent.  Years '0000' and '00' are different, as '00' is the two year code for 2000.  The rest of the math checks out correctly.

Year '0000' does weird things in PHP now, though.
PHP Copyright © 2001-2016 The PHP Group
All rights reserved.
Last updated: Tue Oct 25 05:01:52 2016 UTC