|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-09-14 21:51 UTC] amykhar at gmail dot com
Description:
------------
If I enter a date with a text month and an invalid day, it returns as valid.
Example, September 45, 1992 returns as valid. It THINKS the date is October 5, 1992.
(The same is true for Sep 45, 1992).
What it seems to do is to get the year correctly, then take the last digit of the day and then add 1 to the month.
Reproduce code:
---------------
$cdate = strtotime("September 45, 1992");
if(!$cdate){
echo(-1);
exit;
}
else{
echo (date("M d Y",$cdate);
}
Expected result:
----------------
It echo -1.
Actual result:
--------------
It prints out October 5, 1992
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 19:00:01 2025 UTC |
I'm having the same problem. strtotime("February 31, 2007 18:45:00 GMT")should return FALSE but it just gets converted to March 3. I'm using PHP 5.2.1 running on Windows.