note 90881 added to function.strtotime
| From: | PHP_Chimp at osu1 dot php dot net | Date: | Thu, 14 May 2009 13:08:14 +0000 |
| Subject: | note 90881 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154593@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 87.124.35.190
Probable Submitter: 62.31.182.133
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/90881
Del: integrated -- https://master.php.net/note/delete/90881/integrated
Del: useless -- https://master.php.net/note/delete/90881/useless
Del: bad code -- https://master.php.net/note/delete/90881/bad+code
Del: spam -- https://master.php.net/note/delete/90881/spam
Del: non-english -- https://master.php.net/note/delete/90881/non-english
Del: in docs -- https://master.php.net/note/delete/90881/in+docs
Del: other reasons-- https://master.php.net/note/delete/90881
Reject -- https://master.php.net/note/reject/90881
Search -- https://master.php.net/manage/user-notes.php