3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $derivation = new \DateTime(); echo $derivation->format('Y m d H:i:s'); $derivation->sub(\DateInterval::createFromDateString('10 hours')); echo $derivation->format('Y m d H:i:s');
Output for 5.6.28, 7.0.14 - 7.1.0
2014 03 13 21:40:502014 03 13 11:40:50
Output for 7.0.6
2016 05 03 05:52:272016 05 02 19:52:27
Output for 7.0.5
2016 04 02 18:57:012016 04 02 08:57:01
Output for 7.0.4
2016 03 10 04:54:552016 03 09 18:54:55
Output for 7.0.3
2016 03 18 05:17:162016 03 17 19:17:16
Output for 7.0.2
2016 03 21 15:44:042016 03 21 05:44:04
Output for 7.0.1
2016 03 23 16:20:102016 03 23 06:20:10
Output for 7.0.0
2016 03 26 18:06:012016 03 26 08:06:01
Output for 5.6.21
2016 05 02 01:07:212016 05 01 15:07:21
Output for 5.6.20
2016 04 09 14:13:292016 04 09 04:13:29
Output for 5.6.19
2016 03 07 04:59:252016 03 06 18:59:25
Output for 5.6.18
2016 03 14 17:57:112016 03 14 07:57:11
Output for 5.6.17
2016 03 19 09:40:162016 03 18 23:40:16
Output for 5.6.16
2016 03 27 19:51:522016 03 27 09:51:52
Output for 5.6.15
2016 03 28 20:44:402016 03 28 10:44:40
Output for 5.6.14
2016 04 01 23:15:162016 04 01 13:15:16
Output for 5.6.13
2016 04 15 03:17:032016 04 14 17:17:03
Output for 5.6.12
2016 04 19 16:45:562016 04 19 06:45:56
Output for 5.6.11
2016 04 22 23:41:062016 04 22 13:41:06
Output for 5.6.10
2016 04 25 01:34:042016 04 24 15:34:04
Output for 5.6.9
2016 04 27 06:34:352016 04 26 20:34:35
Output for 5.6.8
2016 04 29 14:25:562016 04 29 04:25:56
Output for 5.6.7
2016 05 25 04:30:512016 05 24 18:30:51
Output for 5.5.35
2016 05 22 04:44:222016 05 21 18:44:22
Output for 5.5.34
2016 04 10 20:10:402016 04 10 10:10:40
Output for 5.5.33
2016 03 08 15:50:262016 03 08 05:50:26
Output for 5.5.32
2016 03 16 21:47:032016 03 16 11:47:03
Output for 5.5.31
2016 03 20 12:31:002016 03 20 02:31:00
Output for 5.5.30
2016 03 31 22:45:522016 03 31 12:45:52
Output for 5.5.29
2016 04 16 17:22:332016 04 16 07:22:33
Output for 5.5.28
2016 04 20 19:48:252016 04 20 09:48:25
Output for 5.5.27
2016 04 21 22:06:502016 04 21 12:06:50
Output for 5.5.26
2016 04 26 03:57:512016 04 25 17:57:51
Output for 5.5.25
2016 04 28 09:55:312016 04 27 23:55:31
Output for 5.5.24
2016 05 23 16:49:552016 05 23 06:49:55
Output for 5.4.45
2015 09 20 22:45:172015 09 20 12:45:17
Output for 5.4.44
2015 09 20 22:45:122015 09 20 12:45:12
Output for 5.4.43
2015 09 20 22:45:062015 09 20 12:45:06
Output for 5.4.42
2015 09 20 22:45:042015 09 20 12:45:04
Output for 5.4.41
2015 09 20 22:45:022015 09 20 12:45:02
Output for 5.4.40
2015 09 20 22:44:592015 09 20 12:44:59
Output for 5.4.39
2015 09 20 22:44:572015 09 20 12:44:57
Output for 5.4.38
2015 03 13 12:24:252015 03 13 02:24:25
Output for 5.4.36 - 5.4.37
2015 03 13 12:24:172015 03 13 02:24:17
Output for 5.4.34 - 5.4.35
2015 03 13 12:24:162015 03 13 02:24:16
Output for 5.4.32
2014 09 07 12:55:432014 09 07 02:55:43
Output for 5.4.31
2014 09 07 12:55:402014 09 07 02:55:40
Output for 5.3.29, 5.4.30
2014 09 07 12:55:362014 09 07 02:55:36
Output for 5.4.28 - 5.4.29
2014 09 07 12:55:352014 09 07 02:55:35
Output for 5.4.27
2014 09 07 12:55:412014 09 07 02:55:41
Output for 5.4.10 - 5.4.26
2014 03 13 21:40:512014 03 13 11:40:51
Output for 5.3.19 - 5.3.28, 5.4.0 - 5.4.9
2014 03 13 21:40:522014 03 13 11:40:52
Output for 5.3.0 - 5.3.18
2014 03 13 21:40:532014 03 13 11:40:53
Output for 5.2.15 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 5 2014 03 13 21:40:53 Fatal error: Call to undefined method DateTime::sub() in /in/EloJb on line 5
Process exited with code 255.
Output for 5.2.0 - 5.2.14
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 5 2014 03 13 21:40:54 Fatal error: Call to undefined method DateTime::sub() in /in/EloJb on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 5 Fatal error: Class 'DateTime' not found in /in/EloJb on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 5 Fatal error: Cannot instantiate non-existent class: datetime in /in/EloJb 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/EloJb on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/EloJb on line 5 Fatal error: Cannot instantiate non-existent class: datetime in /in/EloJb on line 2