|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-05-29 09:57 UTC] aldekein at myevil dot info
Description:
------------
So why do strtotime return current date instead of correct date or FALSE?
Test script:
---------------
$datetime = strtotime('11.05.07');
if ($datetime === false) die('fail');
echo date('d.m.Y', $datetime);
Expected result:
----------------
11.05.2007
Actual result:
--------------
29.05.2012 (current date)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 15:00:01 2025 UTC |
It tries to parse value as time. And strtotime('11.05.07 00:00:00') === falseI believe that there's a problem in format parser that cause disambiguation: strtotime('24.11.07') is parsed as valid time. strtotime('25.11.07') is parsed as valid date. http://us2.php.net/manual/en/datetime.formats.date.php declares dd [.\t] mm "." yy http://us2.php.net/manual/en/datetime.formats.time.php declares 't'? HH [.:] MM [.:] II