php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #28088 strtotime() cannot convert 00 hours
Submitted: 2004-04-21 11:02 UTC Modified: 2005-06-20 09:27 UTC
Votes:15
Avg. Score:4.2 ± 1.2
Reproduced:7 of 8 (87.5%)
Same Version:5 (71.4%)
Same OS:4 (57.1%)
From: asif at evoknow dot com Assigned: derick (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 4.3.4 OS: Red Hat Linux
Private report: No CVE-ID: None
 [2004-04-21 11:02 UTC] asif at evoknow dot com
Description:
------------
When  a string like "04/04/04 0045" is passed to strtotime(), it returns -1. 

Reproduce code:
---------------
echo "The following line rightly shows the correct date time\r\n";
echo date("m/d/y Hi", strtotime("04/04/04 2345"));
echo "\r\nBut the following line fails to show the correct date time\r\n";
echo date("m/d/y Hi", strtotime("04/04/04 0045"))."\r\n";

Expected result:
----------------
The following line rightly shows the correct date time
04/04/04 2345
But the following line fails to show the correct date time
04/04/04 0045



Actual result:
--------------
The following line rightly shows the correct date time
04/04/04 2345
But the following line fails to show the correct date time
01/01/70 0559


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-20 02:46 UTC] tim at komta dot com
'00' is the designation for midnight as returned by the date() function, as in: date('m/d/Y Hi')

For sanity's sake, it really should work.
 [2004-08-20 03:40 UTC] tim at komta dot com
BTW, strtotime DOES work with input such as 8/20/2004 00:23, it's only without the colon that it seems to fail.
 [2005-06-20 09:27 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed for PHP 5.1
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC