3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateTime = new DateTime('now'); echo $dateTime -> format('Y-m-d H:i:s'); $dateTime -> modify('-10 seconds'); echo $dateTime -> format('Y-m-d H:i:s');
Output for 5.3.1, 5.3.3 - 5.3.4, 5.3.7 - 5.3.10, 5.3.12, 5.3.14 - 5.3.17, 5.3.19, 5.3.21 - 5.3.23, 5.3.26 - 5.3.27, 5.4.0, 5.4.2, 5.4.6 - 5.4.7, 5.4.9 - 5.4.10, 5.4.13 - 5.4.27, 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
2014-04-08 10:54:522014-04-08 10:54:42
Output for 7.3.32 - 7.3.33, 8.0.13
2014-04-08 08:54:522014-04-08 08:54:42
Output for 7.0.6
2016-05-03 00:12:452016-05-03 00:12:35
Output for 7.0.5
2016-04-02 13:47:022016-04-02 13:46:52
Output for 7.0.4
2016-03-09 22:42:212016-03-09 22:42:11
Output for 7.0.3
2016-03-17 23:06:252016-03-17 23:06:15
Output for 7.0.2
2016-03-21 09:49:422016-03-21 09:49:32
Output for 7.0.1
2016-03-23 09:28:312016-03-23 09:28:21
Output for 7.0.0
2016-03-26 12:36:022016-03-26 12:35:52
Output for 5.6.21
2016-05-01 19:18:342016-05-01 19:18:24
Output for 5.6.20
2016-04-09 09:03:162016-04-09 09:03:06
Output for 5.6.19
2016-03-06 19:56:502016-03-06 19:56:40
Output for 5.6.18
2016-03-14 08:03:562016-03-14 08:03:46
Output for 5.6.17
2016-03-19 03:42:312016-03-19 03:42:21
Output for 5.6.16
2016-03-27 14:19:172016-03-27 14:19:07
Output for 5.6.15
2016-03-28 15:17:082016-03-28 15:16:58
Output for 5.6.14
2016-04-01 18:01:072016-04-01 18:00:57
Output for 5.6.13
2016-04-14 21:57:542016-04-14 21:57:44
Output for 5.6.12
2016-04-19 11:00:372016-04-19 11:00:27
Output for 5.6.11
2016-04-22 18:19:502016-04-22 18:19:40
Output for 5.6.10
2016-04-24 19:57:392016-04-24 19:57:29
Output for 5.6.9
2016-04-27 01:00:572016-04-27 01:00:47
Output for 5.6.8
2016-04-29 08:36:132016-04-29 08:36:03
Output for 5.6.7
2016-05-24 18:10:362016-05-24 18:10:26
Output for 5.5.35
2016-05-21 22:30:542016-05-21 22:30:44
Output for 5.5.34
2016-04-10 14:36:322016-04-10 14:36:22
Output for 5.5.33
2016-03-08 09:49:022016-03-08 09:48:52
Output for 5.5.32
2016-03-15 18:52:382016-03-15 18:52:28
Output for 5.5.31
2016-03-20 06:36:552016-03-20 06:36:45
Output for 5.5.30
2016-03-31 17:23:422016-03-31 17:23:32
Output for 5.5.29
2016-04-16 11:58:292016-04-16 11:58:19
Output for 5.5.28
2016-04-20 14:09:462016-04-20 14:09:36
Output for 5.5.27
2016-04-21 16:50:292016-04-21 16:50:19
Output for 5.5.26
2016-04-25 22:11:482016-04-25 22:11:38
Output for 5.5.25
2016-04-28 04:18:202016-04-28 04:18:10
Output for 5.5.24
2016-04-30 11:59:012016-04-30 11:58:51
Output for 5.4.45
2015-09-11 12:54:262015-09-11 12:54:16
Output for 5.4.44
2015-09-11 12:54:232015-09-11 12:54:13
Output for 5.4.43
2015-07-18 14:42:072015-07-18 14:41:57
Output for 5.4.42
2015-07-18 14:42:052015-07-18 14:41:55
Output for 5.4.41
2015-05-26 01:59:352015-05-26 01:59:25
Output for 5.4.40
2015-05-15 08:32:012015-05-15 08:31:51
Output for 5.4.39
2015-05-15 08:32:002015-05-15 08:31:50
Output for 5.4.38
2015-03-02 20:01:262015-03-02 20:01:16
Output for 5.4.37
2015-02-09 00:41:572015-02-09 00:41:47
Output for 5.4.34 - 5.4.36
2015-02-09 00:41:562015-02-09 00:41:46
Output for 5.4.32
2014-09-08 21:18:002014-09-08 21:17:50
Output for 5.4.31
2014-09-08 21:17:572014-09-08 21:17:47
Output for 5.3.29, 5.4.29 - 5.4.30
2014-09-08 21:17:542014-09-08 21:17:44
Output for 5.4.28
2014-09-08 21:17:532014-09-08 21:17:43
Output for 5.2.0 - 5.2.17, 5.3.0, 5.3.2, 5.3.5 - 5.3.6, 5.3.11, 5.3.13, 5.3.18, 5.3.20, 5.3.24 - 5.3.25, 5.3.28, 5.4.1, 5.4.3 - 5.4.5, 5.4.8, 5.4.11 - 5.4.12
2014-04-08 10:54:512014-04-08 10:54:41
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/QTJlb on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/QTJlb 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/QTJlb on line 3

preferences:
232.64 ms | 401 KiB | 317 Q