note 90881 deleted from function.strtotime by derick
| From: | derick@php.net | Date: | Sun, 14 Dec 2014 11:35:45 +0000 |
| Subject: | note 90881 deleted from function.strtotime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-201169@lists.php.net to get a copy of this message | ||
Note Submitter: PHP_Chimp
----
A warning for those that think that their is only one way to interpret 2009 April 4th...PHP thinks
otherwise.
<?php
$test = "April 4th 2009";
if (strtotime($test) === false) {
echo "test == false <br />\n t = $test";
}
else {
echo "test == true";
}
?>
Works fine, with the American 'Month Day Year'.
<?php
$test = "2009 April 4th";
if (strtotime($test) === false) {
echo "test == false <br />\n t = $test";
}
else {
echo "test == true";
}
?>
Will produce a false result. It seems that even with a 4 figure year that the American date format
overrules the obviousness of 2009 April 4th.