3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tz = new \DateTimeZone('Europe/Berlin'); $d1 = new \DateTime(); $d2 = new \DateTime($d1->format(\DateTime::ATOM), $tz); $d3 = new \DateTime($d1->format('Y-m-d H:i'), $tz); var_dump($d1); var_dump($d2); var_dump($d3);
Output for 7.3.0rc3
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.002462" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.3.0beta1
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.002729" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.3.0alpha1
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.039054" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.2.6
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.003814" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.2.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.003018" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.2.4
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.005787" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.2.3
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.024796" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.2.2
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.029440" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.2.1
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.024933" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.2.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.008060" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.20
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.001874" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.16
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.011498" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.15
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.020182" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.14
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.014268" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.13
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.004919" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.12
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.030680" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.11
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.006070" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.10
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.009775" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.9
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.014849" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.8
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.015122" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.7
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.023686" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.6
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.041346" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.055159" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.4
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.028123" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 5.6.0 - 5.6.30, hhvm-3.21.3 - 3.22.0, 7.1.3
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.2
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.034074" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.1
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.023345" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 7.1.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.012065" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:41.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for hhvm-3.18.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2018-04-03 13:22:42.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2018-04-03 13:22:42.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#4 (3) { ["date"]=> string(26) "2018-04-03 13:22:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }