3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dt = new DateTime('now', new DateTimeZone('Europe/Madrid')); var_dump($dt, $dt->getTimestamp()); $dt->setTimezone(new DateTimeZone('America/Bogota')); var_dump($dt, $dt->getTimestamp());
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-07-08 16:30:18.004033" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1404829818) object(DateTime)#1 (3) { ["date"]=> string(26) "2014-07-08 09:30:18.004033" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1404829818)
Output for 5.6.28, 7.0.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-07-08 16:30:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1404829818) object(DateTime)#1 (3) { ["date"]=> string(26) "2014-07-08 09:30:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1404829818)
Output for 7.0.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-03 16:50:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1462287005) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-03 09:50:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1462287005)
Output for 7.0.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-03 05:19:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1459653588) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 22:19:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1459653588)
Output for 7.0.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-10 16:57:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1457625449) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-10 10:57:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1457625449)
Output for 7.0.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-18 17:42:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1458319370) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-18 11:42:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1458319370)
Output for 7.0.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-22 23:49:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1458686959) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-22 17:49:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1458686959)
Output for 7.0.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-24 03:59:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1458788351) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-23 21:59:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1458788351)
Output for 7.0.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-27 05:56:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1459050973) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-26 22:56:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1459050973)
Output for 5.6.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 12:00:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1462183205) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 05:00:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1462183205)
Output for 5.6.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-10 04:18:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1460254702) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-09 21:18:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1460254702)
Output for 5.6.19
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-08 00:46:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1457394394) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 18:46:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1457394394)
Output for 5.6.18
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-15 09:37:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1458031023) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-15 03:37:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1458031023)
Output for 5.6.17
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-19 21:30:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1458419444) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-19 15:30:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1458419444)
Output for 5.6.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 06:43:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1459140234) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-27 23:43:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1459140234)
Output for 5.6.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-29 07:34:46.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1459229686) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-29 00:34:46.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1459229686)
Output for 5.6.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 09:30:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1459582251) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 02:30:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1459582251)
Output for 5.6.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-15 13:48:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1460720897) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-15 06:48:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1460720897)
Output for 5.6.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-20 04:14:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461118485) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-19 21:14:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461118485)
Output for 5.6.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-23 10:45:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461401109) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-23 03:45:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461401109)
Output for 5.6.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 12:40:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461580843) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 05:40:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461580843)
Output for 5.6.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-27 17:49:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461772155) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-27 10:49:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461772155)
Output for 5.6.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-30 02:33:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461976400) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-29 19:33:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461976400)
Output for 5.5.35
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 17:43:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1463931795) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 10:43:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1463931795)
Output for 5.5.34
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 06:32:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1460349127) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-10 23:32:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1460349127)
Output for 5.5.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-09 03:45:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1457491556) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-08 21:45:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1457491556)
Output for 5.5.32
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-17 13:20:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1458217231) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-17 07:20:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1458217231)
Output for 5.5.31
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-21 00:22:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1458516175) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-20 18:22:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1458516175)
Output for 5.5.30
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-01 09:28:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1459495683) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-01 02:28:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1459495683)
Output for 5.5.29
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-17 04:12:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1460859179) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-16 21:12:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1460859179)
Output for 5.5.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-21 07:25:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461216339) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-21 00:25:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461216339)
Output for 5.5.27
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-22 09:20:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461309622) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-22 02:20:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461309622)
Output for 5.5.26
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-26 15:21:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461676917) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-26 08:21:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461676917)
Output for 5.5.25
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-28 22:12:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1461874353) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-28 15:12:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1461874353)
Output for 5.5.24
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-24 04:54:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1464058497) object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-23 21:54:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1464058497)
Output for 5.4.45
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 00:33:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1442788435) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-20 17:33:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1442788435)
Output for 5.4.44
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 00:33:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1442788403) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-20 17:33:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1442788403)
Output for 5.4.43
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 00:32:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1442788374) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-20 17:32:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1442788374)
Output for 5.4.42
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 00:32:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1442788365) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-20 17:32:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1442788365)
Output for 5.4.41
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 00:32:35.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1442788355) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-20 17:32:35.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1442788355)
Output for 5.4.40
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 00:32:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1442788345) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-20 17:32:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1442788345)
Output for 5.4.39
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 00:32:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1442788339) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-20 17:32:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1442788339)
Output for 5.4.38
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-04 17:30:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1425486643) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-04 11:30:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1425486643)
Output for 5.4.36 - 5.4.37
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-04 17:30:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1425486634) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-04 11:30:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1425486634)
Output for 5.4.34 - 5.4.35
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-04 17:30:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1425486633) object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-04 11:30:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1425486633)
Output for 5.4.32
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-09-13 12:57:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1410605841) object(DateTime)#1 (3) { ["date"]=> string(26) "2014-09-13 05:57:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1410605841)
Output for 5.4.31
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-09-13 12:57:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1410605840) object(DateTime)#1 (3) { ["date"]=> string(26) "2014-09-13 05:57:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1410605840)
Output for 5.4.30
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-07-08 16:30:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1404829823) object(DateTime)#1 (3) { ["date"]=> string(26) "2014-07-08 09:30:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1404829823)
Output for 5.4.15 - 5.4.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2014-07-08 16:30:23" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1404829823) object(DateTime)#1 (3) { ["date"]=> string(19) "2014-07-08 09:30:23" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1404829823)
Output for 5.3.25 - 5.3.28, 5.4.0 - 5.4.14
object(DateTime)#1 (3) { ["date"]=> string(19) "2014-07-08 16:30:24" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1404829824) object(DateTime)#1 (3) { ["date"]=> string(19) "2014-07-08 09:30:24" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1404829824)
Output for 5.3.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2014-09-13 12:57:19" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1410605839) object(DateTime)#1 (3) { ["date"]=> string(19) "2014-09-13 05:57:19" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1410605839)
Output for 5.3.9 - 5.3.24
object(DateTime)#1 (3) { ["date"]=> string(19) "2014-07-08 16:30:25" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1404829825) object(DateTime)#1 (3) { ["date"]=> string(19) "2014-07-08 09:30:25" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1404829825)
Output for 5.3.0 - 5.3.8
object(DateTime)#1 (3) { ["date"]=> string(19) "2014-07-08 16:30:26" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Madrid" } int(1404829826) object(DateTime)#1 (3) { ["date"]=> string(19) "2014-07-08 09:30:26" ["timezone_type"]=> int(3) ["timezone"]=> string(14) "America/Bogota" } int(1404829826)
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::getTimestamp() in /in/YbQ7N on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/YbQ7N 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/YbQ7N 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/YbQ7N on line 3