3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new DateTimeImmutable('2015-09-01+00:00'); var_dump($date); $date = $date->setTimezone(new DateTimeZone('-09:00')); var_dump($date); $date = $date->setTimezone(new DateTimeZone('+00:00')); var_dump($date);
based on JtAdV
Output for 7.0.20, 7.1.5 - 7.2.0
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-08-31 15:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "-09:00" } object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.24 - 7.0.6, 7.1.0
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-09-01 00:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-08-31 15:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "-09:00" } object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-08-31 15:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.3.20 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/B1rTa on line 3
Process exited with code 255.