3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime("now"); print $now->format("Y-m-d"); var_dump($now); $clone = clone $now; $clone->modify( '-1 day' );
based on UKQkg
Output for 7.1.0
2014-10-10object(DateTime)#1 (3) { ["date"]=> string(26) "2014-10-10 17:41:09.003955" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.28, 7.0.14
2014-10-10object(DateTime)#1 (3) { ["date"]=> string(26) "2014-10-10 17:41:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.6
2016-05-03object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-03 10:22:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.5
2016-04-02object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 23:09:14.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.4
2016-03-10object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-10 09:45:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.3
2016-03-18object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-18 10:25:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.2
2016-03-22object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-22 16:23:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.1
2016-03-23object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-23 20:59:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.0
2016-03-26object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-26 22:31:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.21
2016-05-02object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 05:42:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.20
2016-04-09object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-09 22:08:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.19
2016-03-07object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 17:52:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.18
2016-03-15object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-15 01:58:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.17
2016-03-19object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-19 14:38:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.16
2016-03-28object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 00:23:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.15
2016-03-29object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-29 01:24:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.14
2016-04-02object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 03:43:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.13
2016-04-15object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-15 07:37:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.12
2016-04-19object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-19 21:25:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.11
2016-04-23object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-23 04:27:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.10
2016-04-25object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 06:12:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.9
2016-04-27object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-27 11:11:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.8
2016-04-29object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-29 19:19:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.35
2016-05-22object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 09:30:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.34
2016-04-11object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 00:28:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.33
2016-03-08object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-08 20:49:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.32
2016-03-17object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-17 03:32:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.31
2016-03-20object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-20 17:24:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.30
2016-04-01object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-01 03:20:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.29
2016-04-16object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-16 21:44:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.28
2016-04-21object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-21 00:41:41.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.27
2016-04-22object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-22 02:59:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.26
2016-04-26object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-26 08:38:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.25
2016-04-28object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-28 14:57:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.24
2016-05-24object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-24 15:46:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.45
2015-09-20object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-20 14:18:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.44
2015-08-17object(DateTime)#1 (3) { ["date"]=> string(26) "2015-08-17 07:06:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.43
2015-08-17object(DateTime)#1 (3) { ["date"]=> string(26) "2015-08-17 07:06:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.42
2015-07-09object(DateTime)#1 (3) { ["date"]=> string(26) "2015-07-09 04:57:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.41
2015-07-09object(DateTime)#1 (3) { ["date"]=> string(26) "2015-07-09 04:57:14.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.39 - 5.4.40
2015-07-09object(DateTime)#1 (3) { ["date"]=> string(26) "2015-07-09 04:57:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.38
2015-03-15object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-15 19:50:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.36 - 5.4.37
2015-03-15object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-15 19:50:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.34 - 5.4.35
2015-03-15object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-15 19:50:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.30 - 5.4.32
2014-10-10object(DateTime)#1 (3) { ["date"]=> string(26) "2014-10-10 17:41:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.26 - 5.4.29
2014-10-10object(DateTime)#1 (3) { ["date"]=> string(19) "2014-10-10 17:41:12" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.3 - 5.4.25
2014-10-10object(DateTime)#1 (3) { ["date"]=> string(19) "2014-10-10 17:41:13" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.12 - 5.4.2
2014-10-10object(DateTime)#1 (3) { ["date"]=> string(19) "2014-10-10 17:41:14" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.0 - 5.3.11
2014-10-10object(DateTime)#1 (3) { ["date"]=> string(19) "2014-10-10 17:41:15" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.2.0 - 5.2.17
2014-10-10object(DateTime)#1 (0) { }
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/9SLfD on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/9SLfD on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/9SLfD on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/9SLfD on line 5
Process exited with code 255.