3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime(); echo $date->format('Y-m-d H:i:s') . PHP_EOL; $date = new DateTime('-5 minutes'); echo $date->format('Y-m-d H:i:s');
Output for 5.6.28, 7.0.14 - 7.1.0
2014-03-10 22:24:09 2014-03-10 22:19:09
Output for 7.0.6
2016-05-03 02:12:24 2016-05-03 02:07:24
Output for 7.0.5
2016-04-02 15:27:37 2016-04-02 15:22:37
Output for 7.0.4
2016-03-10 00:55:54 2016-03-10 00:50:54
Output for 7.0.3
2016-03-18 01:08:08 2016-03-18 01:03:08
Output for 7.0.2
2016-03-21 11:43:13 2016-03-21 11:38:13
Output for 7.0.1
2016-03-23 11:54:58 2016-03-23 11:49:58
Output for 7.0.0
2016-03-26 14:26:18 2016-03-26 14:21:18
Output for 5.6.21
2016-05-01 21:14:44 2016-05-01 21:09:44
Output for 5.6.20
2016-04-09 10:42:24 2016-04-09 10:37:24
Output for 5.6.19
2016-03-06 23:11:13 2016-03-06 23:06:13
Output for 5.6.18
2016-03-14 10:51:21 2016-03-14 10:46:21
Output for 5.6.17
2016-03-19 05:37:05 2016-03-19 05:32:05
Output for 5.6.16
2016-03-27 16:11:21 2016-03-27 16:06:21
Output for 5.6.15
2016-03-28 17:04:57 2016-03-28 16:59:57
Output for 5.6.14
2016-04-01 19:43:28 2016-04-01 19:38:28
Output for 5.6.13
2016-04-14 23:31:23 2016-04-14 23:26:23
Output for 5.6.12
2016-04-19 12:39:39 2016-04-19 12:34:39
Output for 5.6.11
2016-04-22 19:55:44 2016-04-22 19:50:44
Output for 5.6.10
2016-04-24 21:35:46 2016-04-24 21:30:46
Output for 5.6.9
2016-04-27 02:44:53 2016-04-27 02:39:53
Output for 5.6.8
2016-04-29 10:20:06 2016-04-29 10:15:06
Output for 5.6.7
2016-05-24 21:00:23 2016-05-24 20:55:23
Output for 5.5.35
2016-05-22 00:35:02 2016-05-22 00:30:02
Output for 5.5.34
2016-04-10 16:38:05 2016-04-10 16:33:05
Output for 5.5.33
2016-03-08 11:50:03 2016-03-08 11:45:03
Output for 5.5.32
2016-03-16 17:30:41 2016-03-16 17:25:41
Output for 5.5.31
2016-03-20 08:30:04 2016-03-20 08:25:04
Output for 5.5.30
2016-03-31 19:06:23 2016-03-31 19:01:23
Output for 5.5.29
2016-04-16 13:38:06 2016-04-16 13:33:06
Output for 5.5.28
2016-04-20 15:54:03 2016-04-20 15:49:03
Output for 5.5.27
2016-04-21 18:27:30 2016-04-21 18:22:30
Output for 5.5.26
2016-04-25 23:53:06 2016-04-25 23:48:06
Output for 5.5.25
2016-04-28 06:01:18 2016-04-28 05:56:18
Output for 5.5.24
2016-04-30 13:32:37 2016-04-30 13:27:37
Output for 5.4.45
2015-09-14 04:17:12 2015-09-14 04:12:12
Output for 5.4.44
2015-09-14 04:17:09 2015-09-14 04:12:09
Output for 5.4.43
2015-09-14 04:17:05 2015-09-14 04:12:05
Output for 5.4.42
2015-09-14 04:17:04 2015-09-14 04:12:04
Output for 5.4.41
2015-09-14 04:17:02 2015-09-14 04:12:02
Output for 5.4.40
2015-05-10 16:57:03 2015-05-10 16:52:03
Output for 5.4.39
2015-05-10 16:57:02 2015-05-10 16:52:02
Output for 5.4.38
2015-03-02 13:41:57 2015-03-02 13:36:57
Output for 5.4.35 - 5.4.37
2015-02-08 09:37:27 2015-02-08 09:32:27
Output for 5.4.34
2015-02-08 09:37:26 2015-02-08 09:32:26
Output for 5.4.32
2014-09-07 09:11:00 2014-09-07 09:06:00
Output for 5.4.31
2014-09-07 09:10:57 2014-09-07 09:05:57
Output for 5.3.29, 5.4.30
2014-09-07 09:10:54 2014-09-07 09:05:54
Output for 5.4.28 - 5.4.29
2014-09-07 09:10:53 2014-09-07 09:05:53
Output for 5.4.27
2014-09-07 09:10:58 2014-09-07 09:05:58
Output for 5.4.20 - 5.4.26
2014-03-10 22:24:10 2014-03-10 22:19:10
Output for 5.3.27 - 5.3.28, 5.4.0 - 5.4.19
2014-03-10 22:24:11 2014-03-10 22:19:11
Output for 5.3.6 - 5.3.26
2014-03-10 22:24:12 2014-03-10 22:19:12
Output for 5.2.0 - 5.3.5
2014-03-10 22:24:13 2014-03-10 22:19:13
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/50nbQ 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/50nbQ 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/50nbQ on line 3