3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime(NULL, new DateTimeZone('Europe/Rome')); echo $date->format('Y-m-d H:i:s O'), "\n"; $result = $date->modify('15 minutes ago'); echo $date->format('Y-m-d H:i:s O'), "\n"; var_dump($result);
Output for 7.3.0rc4
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.003547" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.3.0rc3
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.004989" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.3.0beta1
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.003258" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.3.0alpha1
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.003069" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.2.6
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.002932" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.2.0
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.005844" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.1.20
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.003338" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.1.10
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.005046" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.1.7
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.002650" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.1.6
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.010473" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.1.5
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.009543" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 7.1.0
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.006114" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.0.20
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(26) "2014-04-25 14:44:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 5.3.0 - 5.4.29, 5.5.0 - 5.5.13
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 object(DateTime)#1 (3) { ["date"]=> string(19) "2014-04-25 14:44:59" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Rome" }
Output for 5.2.0 - 5.2.17
2014-04-25 14:59:59 +0200 2014-04-25 14:44:59 +0200 NULL
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/D2HCd on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/D2HCd on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/D2HCd on line 3