3v4l.org

run code in 300+ PHP versions simultaneously
<?php $derivation = new \DateTime(); echo $derivation->format('Y m d H:i:s') . PHP_EOL; $derivation->sub(\DateInterval::createFromDateString('10 hours')); echo $derivation->format('Y m d H:i:s');
Output for 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 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.6
2014 03 13 21:41:01 2014 03 13 11:41:01
Output for 7.3.32 - 7.3.33, 8.0.13
2014 03 13 20:41:01 2014 03 13 10:41:01
Output for 7.0.6
2016 05 03 02:14:21 2016 05 02 16:14:21
Output for 7.0.5
2016 04 02 15:29:31 2016 04 02 05:29:31
Output for 7.0.4
2016 03 10 00:58:02 2016 03 09 14:58:02
Output for 7.0.3
2016 03 18 01:10:21 2016 03 17 15:10:21
Output for 7.0.2
2016 03 21 11:45:19 2016 03 21 01:45:19
Output for 7.0.1
2016 03 23 11:57:05 2016 03 23 01:57:05
Output for 7.0.0
2016 03 26 14:28:15 2016 03 26 04:28:15
Output for 5.6.21
2016 05 01 21:16:47 2016 05 01 11:16:47
Output for 5.6.20
2016 04 09 10:44:17 2016 04 09 00:44:17
Output for 5.6.19
2016 03 06 23:13:20 2016 03 06 13:13:20
Output for 5.6.18
2016 03 14 10:57:43 2016 03 14 00:57:43
Output for 5.6.17
2016 03 19 05:39:14 2016 03 18 19:39:14
Output for 5.6.16
2016 03 27 16:13:19 2016 03 27 06:13:19
Output for 5.6.15
2016 03 28 17:06:58 2016 03 28 07:06:58
Output for 5.6.14
2016 04 01 19:45:23 2016 04 01 09:45:23
Output for 5.6.13
2016 04 14 23:33:17 2016 04 14 13:33:17
Output for 5.6.12
2016 04 19 12:41:40 2016 04 19 02:41:40
Output for 5.6.11
2016 04 22 19:57:48 2016 04 22 09:57:48
Output for 5.6.10
2016 04 24 21:37:47 2016 04 24 11:37:47
Output for 5.6.9
2016 04 27 02:47:02 2016 04 26 16:47:02
Output for 5.6.8
2016 04 29 10:22:11 2016 04 29 00:22:11
Output for 5.6.7
2016 05 24 21:03:27 2016 05 24 11:03:27
Output for 5.5.35
2016 05 22 00:37:29 2016 05 21 14:37:29
Output for 5.5.34
2016 04 10 16:40:02 2016 04 10 06:40:02
Output for 5.5.33
2016 03 08 11:52:09 2016 03 08 01:52:09
Output for 5.5.32
2016 03 16 17:32:54 2016 03 16 07:32:54
Output for 5.5.31
2016 03 20 08:32:14 2016 03 19 22:32:14
Output for 5.5.30
2016 03 31 19:08:24 2016 03 31 09:08:24
Output for 5.5.29
2016 04 16 13:40:05 2016 04 16 03:40:05
Output for 5.5.28
2016 04 20 15:55:57 2016 04 20 05:55:57
Output for 5.5.27
2016 04 21 18:29:21 2016 04 21 08:29:21
Output for 5.5.26
2016 04 25 23:55:09 2016 04 25 13:55:09
Output for 5.5.25
2016 04 28 06:03:44 2016 04 27 20:03:44
Output for 5.5.24
2016 04 30 13:34:27 2016 04 30 03:34:27
Output for 5.4.44 - 5.4.45
2015 10 14 23:45:01 2015 10 14 13:45:01
Output for 5.4.39 - 5.4.43
2015 10 14 23:45:02 2015 10 14 13:45:02
Output for 5.4.30 - 5.4.38
2015 10 14 23:45:03 2015 10 14 13:45:03
Output for 5.4.20 - 5.4.29
2015 10 14 23:45:04 2015 10 14 13:45:04
Output for 5.4.10 - 5.4.19
2015 10 14 23:45:05 2015 10 14 13:45:05
Output for 5.4.0 - 5.4.9
2015 10 14 23:45:06 2015 10 14 13:45:06
Output for 5.3.21 - 5.3.29
2015 10 14 23:45:07 2015 10 14 13:45:07
Output for 5.3.13 - 5.3.20
2015 10 14 23:45:08 2015 10 14 13:45:08
Output for 5.3.5 - 5.3.12
2015 10 14 23:45:09 2015 10 14 13:45:09
Output for 5.3.0 - 5.3.4
2015 10 14 23:45:10 2015 10 14 13:45:10
Output for 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 5 2015 10 14 23:45:10 Fatal error: Call to undefined method DateTime::sub() in /in/E1M4p on line 5
Process exited with code 255.
Output for 5.2.13 - 5.2.16
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 5 2015 10 14 23:45:11 Fatal error: Call to undefined method DateTime::sub() in /in/E1M4p on line 5
Process exited with code 255.
Output for 5.2.8 - 5.2.12
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 5 2015 10 14 23:45:12 Fatal error: Call to undefined method DateTime::sub() in /in/E1M4p on line 5
Process exited with code 255.
Output for 5.2.3 - 5.2.7
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 5 2015 10 14 23:45:13 Fatal error: Call to undefined method DateTime::sub() in /in/E1M4p on line 5
Process exited with code 255.
Output for 5.2.0 - 5.2.2
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 5 2015 10 14 23:45:14 Fatal error: Call to undefined method DateTime::sub() in /in/E1M4p on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 5 Fatal error: Class 'DateTime' not found in /in/E1M4p on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 5 Fatal error: Cannot instantiate non-existent class: datetime in /in/E1M4p on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/E1M4p on line 5 Fatal error: Cannot instantiate non-existent class: datetime in /in/E1M4p on line 2

preferences:
226.76 ms | 402 KiB | 330 Q