3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dt1 = new DateTime('now', new DateTimeZone('Australia/Perth')); $dt2 = new DateTime('now', new DateTimeZone('Australia/Sydney')); $dt1->setTimezone(new DateTimeZone('UTC')); $dt2->setTimezone(new DateTimeZone('Europe/Kiev')); var_dump($dt1); var_dump($dt2);
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-11-06 10:10:25.003719" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2013-11-06 12:10:25.003739" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.6.28, 7.0.12 - 7.0.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-11-06 10:10:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2013-11-06 12:10:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 7.0.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-03 07:24:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-03 10:24:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.5.34, 5.6.20, 7.0.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.5.32 - 5.5.33, 5.6.18 - 5.6.19, hhvm-3.12.0, 7.0.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.5.31, 5.6.17, 7.0.2 - 7.0.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:35.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:35.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.6.15 - 5.6.16, 7.0.0 - 7.0.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.45, 5.5.29 - 5.5.30, 5.6.13 - 5.6.14, hhvm-3.10.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.6.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 02:45:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-02 05:45:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.43 - 5.4.44, 5.5.27 - 5.5.28, 5.6.11 - 5.6.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.41 - 5.4.42, 5.5.25 - 5.5.26, 5.6.9 - 5.6.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.39 - 5.4.40, 5.5.23 - 5.5.24, 5.6.7 - 5.6.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.36 - 5.4.38, 5.5.21 - 5.5.22, 5.6.5 - 5.6.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:41.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:41.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.35, 5.5.18 - 5.5.20, 5.6.3 - 5.6.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:42.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:42.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.32 - 5.4.34, 5.5.16, 5.6.0 - 5.6.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.5.35
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 06:29:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-22 09:29:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.30 - 5.4.31, 5.5.14 - 5.5.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 01:25:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-13 04:25:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.29, 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:44" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:44" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.25 - 5.4.28, 5.5.8 - 5.5.12
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:45" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:45" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.28, 5.4.21 - 5.4.24, 5.5.6 - 5.5.7
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:46" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:46" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.4.18 - 5.4.20, 5.5.2 - 5.5.5
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:47" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:47" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.26 - 5.3.27, 5.4.16 - 5.4.17, 5.5.0 - 5.5.1
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:48" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:48" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.23 - 5.3.25, 5.4.12 - 5.4.15
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:49" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:49" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.18 - 5.3.22, 5.4.9 - 5.4.11
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:50" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:50" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.15 - 5.3.17, 5.4.6 - 5.4.8
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:51" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:51" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.12 - 5.3.14, 5.4.2 - 5.4.5
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:52" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:52" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.8 - 5.3.11, 5.4.0 - 5.4.1
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:53" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:53" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:43" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:43" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.3 - 5.3.7
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:54" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:54" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.3.0 - 5.3.2
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-13 01:25:55" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(19) "2016-04-13 04:25:55" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Kiev" }
Output for 5.2.0 - 5.2.17
object(DateTime)#1 (0) { } object(DateTime)#2 (0) { }
Output for 5.0.0 - 5.1.6
<br /> <b>Fatal error</b>: Class 'DateTime' not found in <b>/in/R2Hj1</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.9
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: datetime in <b>/in/R2Hj1</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: datetime in <b>/in/R2Hj1</b> on line <b>3</b><br />