3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $d1 = new DateTime('now+02:00'); $d2 = new DateTime(); $d2->setTimezone($d1->getTimezone()); var_dump($d1,$d2);
based on v0DQd
Output for 7.2.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:15.002816" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:15.002825" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.1.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:15.003169" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:15.003176" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.1.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:15.003399" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:15.003405" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.1.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:15.012422" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:15.012432" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.1.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:15.005655" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:15.005661" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:15.004100" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:15.004105" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.28, 7.0.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:15.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:15.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.0.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-03 18:22:32.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-03 18:22:32.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.0.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-03 06:48:03.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-03 06:48:03.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.0.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-10 18:34:31.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-10 19:34:31.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.0.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-18 19:42:24.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-18 20:42:24.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.0.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-23 01:49:48.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-23 02:49:48.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.0.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-24 05:30:03.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-24 06:30:03.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 7.0.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-27 07:26:22.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-27 07:26:22.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 13:31:50.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-02 13:31:50.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-10 05:47:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-10 05:47:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.19
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-08 02:45:35.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-08 03:45:35.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.18
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-15 11:28:43.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-15 12:28:43.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.17
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-19 23:08:25.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-20 00:08:25.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 08:13:40.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-28 08:13:40.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-29 09:04:25.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-29 09:04:25.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 10:55:42.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-02 10:55:42.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-15 15:19:17.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-15 15:19:17.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-20 05:48:27.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-20 05:48:27.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-24 12:10:29.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-24 12:10:29.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 14:13:55.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-25 14:13:55.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-27 19:23:59.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-27 19:23:59.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.6.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-30 04:16:21.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-30 04:16:21.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.35
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 20:28:25.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-22 20:28:25.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.34
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 07:59:07.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-11 07:59:07.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-09 05:27:47.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-09 06:27:47.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.32
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-17 15:23:47.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-17 16:23:47.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.31
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-21 02:09:47.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-21 03:09:47.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.30
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-01 10:57:51.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 10:57:51.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.29
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-17 05:43:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-17 05:43:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-21 09:01:50.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-21 09:01:50.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.27
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-22 10:49:03.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-22 10:49:03.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.26
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-26 16:56:28.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-26 16:56:28.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.25
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-28 23:49:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-28 23:49:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.5.24
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-24 06:22:21.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-24 06:22:21.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.4.41 - 5.4.45
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:27.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:27.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.4.34 - 5.4.40
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:28.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:28.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.4.30 - 5.4.32
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-11-05 08:33:29.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-11-05 09:33:29.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.4.27 - 5.4.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-05 08:33:29" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-05 09:33:29" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.4.26
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-05 08:33:30" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-05 09:33:30" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" }
Output for 5.4.20 - 5.4.25
Warning: DateTime::setTimezone(): Can only do this for zones with ID for now in /in/rpZVt on line 4 object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-05 08:33:30" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-05 08:33:30" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.14 - 5.4.19
Warning: DateTime::setTimezone(): Can only do this for zones with ID for now in /in/rpZVt on line 4 object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-05 08:33:31" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-05 08:33:31" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.7 - 5.4.13
Warning: DateTime::setTimezone(): Can only do this for zones with ID for now in /in/rpZVt on line 4 object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-05 08:33:32" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-05 08:33:32" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.0 - 5.4.6
Warning: DateTime::setTimezone(): Can only do this for zones with ID for now in /in/rpZVt on line 4 object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-05 08:33:33" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-05 08:33:33" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.24 - 5.3.29
Warning: DateTime::setTimezone(): Can only do this for zones with ID for now in /in/rpZVt on line 4 object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-05 08:33:34" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-05 08:33:34" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.19 - 5.3.23
Warning: DateTime::setTimezone(): Can only do this for zones with ID for now in /in/rpZVt on line 4 object(DateTime)#1 (3) { ["date"]=> string(19) "2015-11-05 08:33:35" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+02:00" } object(DateTime)#2 (3) { ["date"]=> string(19) "2015-11-05 08:33:35" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }