3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tz = new DateTimeZone('-09:00'); $dbTz = new DateTimeZone('UTC'); $date = new DateTime('2015-09-01Z', $tz); var_dump($date); $date = $date->setTimezone($tz); var_dump($date); $date = $date->setTimezone($dbTz); var_dump($date);
Output for 7.0.20, 7.1.5 - 7.2.0
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-08-31 15:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "-09:00" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.5.24 - 7.0.6, 7.1.0
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-08-31 15:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "-09:00" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-08-31 15:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.20 - 5.4.45
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (-09:00)' in /in/JGQ3T:3 Stack trace: #0 /in/JGQ3T(3): DateTimeZone->__construct('-09:00') #1 {main} thrown in /in/JGQ3T on line 3
Process exited with code 255.