note 115270 added to datetime.createfromformat
| From: | nicodoggie at gmail dot com | Date: | Wed, 25 Jun 2014 13:20:09 +0000 |
| Subject: | note 115270 added to datetime.createfromformat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199761@lists.php.net to get a copy of this message | ||
I've found that on PHP 5.5.13 (not sure if it happens on other versions) if you enter a month
larger than 12 on a format that takes numeric months, the result will be a DateTime object with its
month equal to the number modulo 12 instead of returning false.
<?php
var_dump(DateTime::createFromFormat('Y-m-d', '2013-22-01'));
?>
results in:
class DateTime#4 (3) {
public $date =>
string(19) "2014-10-01 13:05:05"
public $timezone_type =>
int(3)
public $timezone =>
string(3) "UTC"
}
----
Server IP: 72.52.91.14
Probable Submitter: 125.252.71.190
----
Manual Page -- http://php.net/manual/en/datetime.createfromformat.php
Edit -- https://master.php.net/note/edit/115270
Del: integrated -- https://master.php.net/note/delete/115270/integrated
Del: useless -- https://master.php.net/note/delete/115270/useless
Del: bad code -- https://master.php.net/note/delete/115270/bad+code
Del: spam -- https://master.php.net/note/delete/115270/spam
Del: non-english -- https://master.php.net/note/delete/115270/non-english
Del: in docs -- https://master.php.net/note/delete/115270/in+docs
Del: other reasons-- https://master.php.net/note/delete/115270
Reject -- https://master.php.net/note/reject/115270
Search -- https://master.php.net/manage/user-notes.php