3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set ( 'America/Chicago' ); $datetime_from_datetimestring = \DateTime::createFromFormat('Y-m-d H:i T', '2015-10-22 09:23 CDT'); echo $datetime_from_datetimestring->format('c'); echo PHP_EOL; $datetime_from_iso8601 = new \DateTime('2015-10-22T08:50:39-0500','America/Chicago'); echo $datetime_from_iso8601->format('Y-m-d H:i T');
based on PiMuL
Output for 7.0.0 - 7.2.0
2015-10-22T09:23:00-05:00 Fatal error: Uncaught TypeError: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given in /in/j7bGu:9 Stack trace: #0 /in/j7bGu(9): DateTime->__construct('2015-10-22T08:5...', 'America/Chicago') #1 {main} thrown in /in/j7bGu on line 9
Process exited with code 255.
Output for 5.3.19 - 5.6.28
2015-10-22T09:23:00-05:00 Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 2 to be DateTimeZone, string given' in /in/j7bGu:9 Stack trace: #0 /in/j7bGu(9): DateTime->__construct('2015-10-22T08:5...', 'America/Chicago') #1 {main} thrown in /in/j7bGu on line 9
Process exited with code 255.