3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime('now', new DateTimeZone('Pacific/Auckland')); var_dump($date);
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-10-31 10:56:51.005899" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.6.28, 7.0.12 - 7.0.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-10-31 10:56:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 7.0.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-04 01:27:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.5.33 - 5.5.34, 5.6.19, hhvm-3.12.0, 7.0.4 - 7.0.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.5.31 - 5.5.32, 5.6.17 - 5.6.18, 7.0.2 - 7.0.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.6.15 - 5.6.16, 7.0.0 - 7.0.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
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-12 09:55:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.6.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 20:38:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.6.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.44, 5.5.27 - 5.5.28, 5.6.11 - 5.6.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.41 - 5.4.43, 5.5.25 - 5.5.26, 5.6.9 - 5.6.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
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-12 09:55:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
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-12 09:55:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.34 - 5.4.35, 5.5.18 - 5.5.20, 5.6.3 - 5.6.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.32, 5.5.16, 5.6.0 - 5.6.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.5.35
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-23 01:18:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.30 - 5.4.31, 5.5.14 - 5.5.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-12 09:55:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.29, 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:31" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.26 - 5.4.28, 5.5.11 - 5.5.12
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:32" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.23 - 5.4.25, 5.5.8 - 5.5.10
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:33" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.28, 5.4.21 - 5.4.22, 5.5.6 - 5.5.7
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:34" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.4.19 - 5.4.20, 5.5.2 - 5.5.5
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:35" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.27, 5.4.17 - 5.4.18, 5.5.0 - 5.5.1
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:36" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.24 - 5.3.26, 5.4.13 - 5.4.16
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:37" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.20 - 5.3.23, 5.4.10 - 5.4.12
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:38" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.17 - 5.3.19, 5.4.6 - 5.4.9
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:39" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.13 - 5.3.16, 5.4.3 - 5.4.5
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:40" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.9 - 5.3.12, 5.4.0 - 5.4.2
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:41" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:30" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.4 - 5.3.8
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:42" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.1 - 5.3.3
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:43" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.3.0
object(DateTime)#1 (3) { ["date"]=> string(19) "2016-04-12 09:55:44" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Pacific/Auckland" }
Output for 5.2.0 - 5.2.17
object(DateTime)#1 (0) { }
Output for 5.0.0 - 5.1.6
<br /> <b>Fatal error</b>: Class 'DateTime' not found in <b>/in/f9G9e</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/f9G9e</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/f9G9e</b> on line <b>3</b><br />