3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tz = new \DateTimeZone('Europe/Moscow'); $dt = new DateTimeImmutable('now'); $dt->setTimezone($tz); $timestamp = (int) $dt->format('U'); $timestamp += 1000; $dt2 = \DateTimeImmutable::createFromFormat('U', $timestamp, $tz); var_dump($dt, $dt2);
based on ZXs7g
Output for 7.2.0
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:55:06.004758" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-10-28 15:11:46.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.1.10
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:55:06.004063" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-10-28 15:11:46.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.1.7
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:55:06.003439" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-10-28 15:11:46.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.1.6
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:55:06.011512" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-10-28 15:11:46.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.1.5
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:55:06.005433" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-10-28 15:11:46.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.1.0
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:55:06.004147" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-10-28 15:11:46.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.28, 7.0.20
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-10-28 15:55:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2015-10-28 15:11:46.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.0.6
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-05-03 17:57:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-05-03 16:13:43.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.0.5
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-03 06:24:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-03 04:41:29.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.0.4
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-10 18:09:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-10 17:26:35.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.0.3
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-18 18:58:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-18 18:14:47.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.0.2
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-23 01:22:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-23 00:38:45.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.0.1
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-24 05:06:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-24 04:22:40.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 7.0.0
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-27 07:02:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-27 05:19:12.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.21
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-05-02 13:07:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-05-02 11:24:36.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.20
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-10 05:24:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-10 03:40:44.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.19
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-08 02:20:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-08 01:36:50.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.18
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-15 11:01:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-15 10:18:06.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.17
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-19 22:42:41.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-19 21:59:21.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.16
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-28 07:49:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-28 06:06:27.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.15
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-29 08:40:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-29 06:57:10.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.14
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-02 10:33:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-02 08:50:24.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.13
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-15 14:54:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-15 13:11:13.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.12
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-20 05:23:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-20 03:39:52.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.11
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-24 11:39:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-24 09:55:42.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.10
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-25 13:48:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-25 12:05:12.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.9
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-27 18:58:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-27 17:14:40.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.6.8
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-30 03:51:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-30 02:08:08.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.35
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-05-22 19:32:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-05-22 17:49:33.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.34
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-11 07:36:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-11 05:52:58.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.33
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-09 04:57:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-09 04:13:56.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.32
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-17 14:40:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-17 13:56:45.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.31
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-03-21 01:41:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-03-21 00:58:08.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.30
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-01 10:34:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-01 08:50:44.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.29
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-17 05:18:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-17 03:35:28.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.28
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-21 08:36:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-21 06:52:53.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.27
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-22 10:25:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-22 08:41:48.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.26
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-26 16:31:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-26 14:48:12.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.25
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-04-28 23:22:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-04-28 21:39:13.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.5.24
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2016-05-24 05:57:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2016-05-24 04:13:59.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
Output for 5.3.19 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/mG59Y on line 4
Process exited with code 255.