note 115269 deleted from datetime.createfromformat by mazzanet
| From: | mazzanet@php.net | Date: | Tue, 01 Jul 2014 07:23:08 +0000 |
| Subject: | note 115269 deleted from datetime.createfromformat by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199787@lists.php.net to get a copy of this message | ||
Note Submitter: nicodoggie at gmail dot com
----
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"
}