3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function f($date) { echo $date->format("Y-m-d H:i:s O"), "\n"; } $gmt = new DateTimeZone("GMT"); $date = new DateTime("2015-04-28", $gmt); f($date); $date->setTime(13, 0, 0); f($date); $date->setTime(25, 0, 0); f($date); $date->modify("+1 hour"); f($date);
Output for 5.2.0 - 7.2.0
2015-04-28 00:00:00 +0000 2015-04-28 13:00:00 +0000 2015-04-29 01:00:00 +0000 2015-04-29 02:00:00 +0000
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/a9Crh on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/a9Crh on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/a9Crh on line 6