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:37:29.003161" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:37:29.003161" ["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:37:29.003900" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:37:29.003900" ["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:37:29.002447" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:37:29.002447" ["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:37:29.013023" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:37:29.013023" ["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:37:29.008844" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:37:29.008844" ["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:37:29.004077" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:37:29.004077" ["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:37:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 14:37:29.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 07:07:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 07:07:43.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 20:07:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 20:07:37.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 06:17:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 06:17:21.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 06:44:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 06:44:59.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 12:17:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 12:17:53.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 17:39:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 17:39:04.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 19:20:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 19:20:52.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 02:24:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 02:24:59.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 16:15:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 16:15:40.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 07:48:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 07:48:05.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 20:34:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 20:34:06.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 11:05:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 11:05:02.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 21:05:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 21:05:52.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 21:57:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 21:57:52.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 00:26:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 00:26:29.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 04:30:42.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 04:30:42.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 18:03:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 18:03:00.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 01:00:58.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 01:00:58.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 02:52:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 02:52:31.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 07:51:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 07:51:02.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 15:44:58.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 15:44:58.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 08:07:46.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 08:07:46.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 06:02:41.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 06:02:41.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 21:21:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 21:21:56.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 17:11:46.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 17:11:46.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 23:14:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 23:14:12.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 13:53:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 13:53:36.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 23:57:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 23:57:28.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 18:35:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 18:35:36.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 21:07:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 21:07:26.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 23:33:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 23:33:48.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 05:18:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 05:18:40.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 11:21:14.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 11:21:14.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 18:16:32.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-06-30 18:16:32.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/GTmBg on line 3
Process exited with code 255.