3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $b = new DateTime(); $a = new DateTime('-1 hour'); echo $b->format('c') . PHP_EOL; echo $a->format('c');
based on YsfmI
Output for 5.6.28, 7.0.14 - 7.1.0
2014-08-21T16:38:09+02:00 2014-08-21T15:38:09+02:00
Output for 7.0.6
2016-05-03T09:53:30+02:00 2016-05-03T08:53:30+02:00
Output for 7.0.5
2016-04-02T22:44:04+02:00 2016-04-02T21:44:04+02:00
Output for 7.0.4
2016-03-10T09:17:30+01:00 2016-03-10T08:17:30+01:00
Output for 7.0.3
2016-03-18T09:55:20+01:00 2016-03-18T08:55:20+01:00
Output for 7.0.2
2016-03-22T15:48:53+01:00 2016-03-22T14:48:53+01:00
Output for 7.0.1
2016-03-23T20:33:00+01:00 2016-03-23T19:33:00+01:00
Output for 7.0.0
2016-03-26T22:05:45+01:00 2016-03-26T21:05:45+01:00
Output for 5.6.21
2016-05-02T05:14:17+02:00 2016-05-02T04:14:17+02:00
Output for 5.6.20
2016-04-09T21:41:02+02:00 2016-04-09T20:41:02+02:00
Output for 5.6.19
2016-03-07T17:25:18+01:00 2016-03-07T16:25:18+01:00
Output for 5.6.18
2016-03-15T01:22:12+01:00 2016-03-15T00:22:12+01:00
Output for 5.6.17
2016-03-19T14:10:14+01:00 2016-03-19T13:10:14+01:00
Output for 5.6.16
2016-03-27T23:50:51+02:00 2016-03-27T22:50:51+02:00
Output for 5.6.15
2016-03-29T00:56:07+02:00 2016-03-28T23:56:07+02:00
Output for 5.6.14
2016-04-02T03:16:56+02:00 2016-04-02T02:16:56+02:00
Output for 5.6.13
2016-04-15T07:11:46+02:00 2016-04-15T06:11:46+02:00
Output for 5.6.12
2016-04-19T20:56:30+02:00 2016-04-19T19:56:30+02:00
Output for 5.6.11
2016-04-23T04:00:14+02:00 2016-04-23T03:00:14+02:00
Output for 5.6.10
2016-04-25T05:44:18+02:00 2016-04-25T04:44:18+02:00
Output for 5.6.9
2016-04-27T10:42:08+02:00 2016-04-27T09:42:08+02:00
Output for 5.6.8
2016-04-29T18:48:57+02:00 2016-04-29T17:48:57+02:00
Output for 5.5.35
2016-05-22T08:58:35+02:00 2016-05-22T07:58:35+02:00
Output for 5.5.34
2016-04-11T00:01:28+02:00 2016-04-10T23:01:28+02:00
Output for 5.5.33
2016-03-08T20:22:29+01:00 2016-03-08T19:22:29+01:00
Output for 5.5.32
2016-03-17T03:03:23+01:00 2016-03-17T02:03:23+01:00
Output for 5.5.31
2016-03-20T16:56:04+01:00 2016-03-20T15:56:04+01:00
Output for 5.5.30
2016-04-01T02:51:58+02:00 2016-04-01T01:51:58+02:00
Output for 5.5.29
2016-04-16T21:17:01+02:00 2016-04-16T20:17:01+02:00
Output for 5.5.28
2016-04-21T00:02:34+02:00 2016-04-20T23:02:34+02:00
Output for 5.5.27
2016-04-22T02:31:18+02:00 2016-04-22T01:31:18+02:00
Output for 5.5.26
2016-04-26T08:11:15+02:00 2016-04-26T07:11:15+02:00
Output for 5.5.25
2016-04-28T14:29:12+02:00 2016-04-28T13:29:12+02:00
Output for 5.5.24
2016-05-23T21:50:08+02:00 2016-05-23T20:50:08+02:00
Output for 5.4.45
2015-09-21T12:42:04+02:00 2015-09-21T11:42:04+02:00
Output for 5.4.44
2015-09-21T12:41:59+02:00 2015-09-21T11:41:59+02:00
Output for 5.4.43
2015-09-21T12:41:54+02:00 2015-09-21T11:41:54+02:00
Output for 5.4.42
2015-09-21T12:41:51+02:00 2015-09-21T11:41:51+02:00
Output for 5.4.41
2015-09-21T12:41:47+02:00 2015-09-21T11:41:47+02:00
Output for 5.4.40
2015-09-21T12:41:43+02:00 2015-09-21T11:41:43+02:00
Output for 5.4.39
2015-09-21T12:41:39+02:00 2015-09-21T11:41:39+02:00
Output for 5.4.38
2015-03-13T22:58:08+01:00 2015-03-13T21:58:08+01:00
Output for 5.4.37
2015-03-13T22:58:01+01:00 2015-03-13T21:58:01+01:00
Output for 5.4.34 - 5.4.36
2015-03-13T22:58:00+01:00 2015-03-13T21:58:00+01:00
Output for 5.4.32
2014-08-28T13:12:11+02:00 2014-08-28T12:12:11+02:00
Output for 5.4.22 - 5.4.31
2014-08-21T16:38:13+02:00 2014-08-21T15:38:13+02:00
Output for 5.4.2 - 5.4.21
2014-08-21T16:38:14+02:00 2014-08-21T15:38:14+02:00
Output for 5.3.11 - 5.3.28, 5.4.0 - 5.4.1
2014-08-21T16:38:15+02:00 2014-08-21T15:38:15+02:00
Output for 5.3.29
2014-08-28T13:12:10+02:00 2014-08-28T12:12:10+02:00
Output for 5.2.7 - 5.3.10
2014-08-21T16:38:16+02:00 2014-08-21T15:38:16+02:00
Output for 5.2.0 - 5.2.6
2014-08-21T16:38:17+02:00 2014-08-21T15:38:17+02:00
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/AYq69 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/AYq69 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/AYq69 on line 2