|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-08-10 14:38 UTC] artyomnsk2012 at gmail dot com
Description:
------------
2021-03-34 00:00:00 is correct date for \DateTime::createFromFormat()
var_dump( \DateTime::createFromFormat('Y-m-d H:i:s', '2021-03-34 00:00:00') ) shows
```
class DateTime#1 (3) {
public $date =>
string(26) "2021-04-03 00:00:00.000000"
public $timezone_type =>
int(3)
public $timezone =>
string(3) "UTC"
}
```
Expected behaviour is false or null
Test script:
---------------
var_dump( \DateTime::createFromFormat('Y-m-d H:i:s', '2021-03-34 00:00:00') );
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
> DateTime(Immutable) will roll-over dates and there's currently no way to disable this. However strtotime() function works OK var_dump(strtotime('2021-03-34')) outputs false