1901-12-12T05: 00: 00Z e.g.
I cannot verify this right now, but the DateTime constructor can accept your format without the need for createFromFormat . I can not say from the documentation.
Try
try { $date = new DateTime('1901-12-12T05:00:00Z'); } catch (Exception $e) { echo "Arggh! ".$e->getMessage(); die(); } echo $date->format('Ymd H:i:s');
and see what happens, paying particular attention to whether he understands Z correctly (i.e. makes it UTC time).
DateTime uses 64-bit numbers inside any system and has no range limits.
As said, starting with 5.3, you can use createFromFormat , which can parse any date expressed by one of the date() placeholders. This is the best way, because you force it to analyze a specific pattern, rather than guessing it.
source share