Strange behaviour of php DateTime class
$x = '23120-7-7';
$x = new \DateTime($x);
var_dump($x);
Gives
object(DateTime)#988 (3) {
["date"]=>
string(19) "2000-07-07 23:12:00"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
I wanted to validate date but there is only datetime class in php. How can i check for
that my date is valid ?
Use date_create_from_format
Output:
To see the error detail:
Output: