note 115269 added to datetime.createfromformat
| From: | nicodoggie at gmail dot com | Date: | Wed, 25 Jun 2014 13:13:03 +0000 |
| Subject: | note 115269 added to datetime.createfromformat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199760@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: 121.58.235.98
----
Manual Page -- http://php.net/manual/en/datetime.createfromformat.php
Edit -- https://master.php.net/note/edit/115269
Del: integrated -- https://master.php.net/note/delete/115269/integrated
Del: useless -- https://master.php.net/note/delete/115269/useless
Del: bad code -- https://master.php.net/note/delete/115269/bad+code
Del: spam -- https://master.php.net/note/delete/115269/spam
Del: non-english -- https://master.php.net/note/delete/115269/non-english
Del: in docs -- https://master.php.net/note/delete/115269/in+docs
Del: other reasons-- https://master.php.net/note/delete/115269
Reject -- https://master.php.net/note/reject/115269
Search -- https://master.php.net/manage/user-notes.php