3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = new DateTimeImmutable(); $x = $x->setDate(2015,6,1); var_dump($x); $x = $x->setDate($x->format('Y'), $x->format('n'),30); var_dump($x);
based on SGnE3
Output for 7.2.0
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:38:05.006066" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:38:05.006066" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.10
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:38:05.003235" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:38:05.003235" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.7
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:38:05.002442" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:38:05.002442" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.6
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:38:05.012307" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:38:05.012307" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.5
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:38:05.010911" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:38:05.010911" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.1.0
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:38:05.004079" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:38:05.004079" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.28, 7.0.20
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:38:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:38:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.6
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 04:59:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 04:59:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.5
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 18:08:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 18:08:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.4
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 03:57:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 03:57:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.3
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 04:17:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 04:17:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.2
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:45:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:45:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.1
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 15:23:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 15:23:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.0
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 17:14:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 17:14:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.21
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 00:03:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 00:03:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.20
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 13:23:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 13:23:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.19
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 03:22:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 03:22:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.18
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 16:54:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 16:54:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.17
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 08:42:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 08:42:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.16
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 19:00:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 19:00:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.15
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 19:52:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 19:52:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.14
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 22:25:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 22:25:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.13
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 02:25:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 02:25:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.12
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 15:42:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 15:42:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.11
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 22:49:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 22:49:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.10
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 00:28:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 00:28:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.9
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 05:40:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 05:40:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.8
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 13:28:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 13:28:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.7
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 02:01:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 02:01:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.35
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 03:47:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 03:47:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.34
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 19:20:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 19:20:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.33
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 14:52:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:52:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.32
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 20:42:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 20:42:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.31
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 11:33:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 11:33:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.30
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 21:53:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 21:53:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.29
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 16:29:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 16:29:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.28
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 18:52:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 18:52:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.27
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 21:15:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 21:15:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.26
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 03:01:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 03:01:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.25
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 08:59:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 08:59:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.24
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2015-06-01 15:52:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 15:52:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.18 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/nW617 on line 3
Process exited with code 255.