3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime('now', new DateTimezone('America/New_York')); // We want to add 2 weeks to this date $interval = new DateInterval('P2W'); $date->add($interval); // Perhaps now we wish to change the timezone? $date->setTimezone(new DateTimezone('America/Chicago')); // Echo the formatted date echo $date->format('c');
Output for 5.4.22 - 5.4.27, 5.6.28, 7.0.14 - 7.1.0
2014-04-23T16:16:09-05:00
Output for 7.0.6
2016-05-16T22:51:53-05:00
Output for 7.0.5
2016-04-16T11:56:29-05:00
Output for 7.0.4
2016-03-23T21:54:09-05:00
Output for 7.0.3
2016-03-31T23:16:36-05:00
Output for 7.0.2
2016-04-04T09:43:27-05:00
Output for 7.0.1
2016-04-06T10:19:31-05:00
Output for 7.0.0
2016-04-09T12:05:28-05:00
Output for hhvm-3.12.0
2016-04-10T03:02:36-05:00
Output for hhvm-3.10.0
2016-04-12T19:30:14-05:00
Output for 5.6.21
2016-05-15T18:06:47-05:00
Output for 5.6.20
2016-04-23T07:12:57-05:00
Output for 5.6.19
2016-03-20T21:58:50-05:00
Output for 5.6.18
2016-03-28T11:56:33-05:00
Output for 5.6.17
2016-04-02T03:39:39-05:00
Output for 5.6.16
2016-04-10T12:51:21-05:00
Output for 5.6.15
2016-04-11T13:44:07-05:00
Output for 5.6.14
2016-04-15T16:14:46-05:00
Output for 5.6.13
2016-04-28T20:16:28-05:00
Output for 5.6.12
2016-05-03T09:45:22-05:00
Output for 5.6.11
2016-05-06T16:40:31-05:00
Output for 5.6.10
2016-05-08T18:33:27-05:00
Output for 5.6.9
2016-05-10T23:33:51-05:00
Output for 5.6.8
2016-05-13T07:25:22-05:00
Output for 5.6.7
2016-06-07T21:28:25-05:00
Output for 5.5.35
2016-06-04T21:43:30-05:00
Output for 5.5.34
2016-04-24T13:10:08-05:00
Output for 5.5.33
2016-03-22T08:49:50-05:00
Output for 5.5.32
2016-03-30T15:46:18-05:00
Output for 5.5.31
2016-04-03T06:30:21-05:00
Output for 5.5.30
2016-04-14T15:45:19-05:00
Output for 5.5.29
2016-04-30T10:21:54-05:00
Output for 5.5.28
2016-05-04T12:47:52-05:00
Output for 5.5.27
2016-05-05T15:06:14-05:00
Output for 5.5.26
2016-05-09T20:57:15-05:00
Output for 5.5.25
2016-05-12T02:54:57-05:00
Output for 5.5.24
2016-06-06T09:48:58-05:00
Output for 5.4.45
2015-10-04T16:02:54-05:00
Output for 5.4.44
2015-10-04T16:02:49-05:00
Output for 5.4.43
2015-10-04T16:02:43-05:00
Output for 5.4.42
2015-10-04T16:02:41-05:00
Output for 5.4.41
2015-10-04T16:02:39-05:00
Output for 5.4.40
2015-10-04T16:02:36-05:00
Output for 5.4.39
2015-10-04T16:02:34-05:00
Output for 5.4.38
2015-03-19T05:22:25-05:00
Output for 5.4.35 - 5.4.37
2015-03-19T05:22:16-05:00
Output for 5.4.34
2015-03-19T05:22:15-05:00
Output for 5.4.32
2014-09-12T23:12:34-05:00
Output for 5.4.31
2014-09-12T23:12:30-05:00
Output for 5.4.29 - 5.4.30
2014-09-12T23:12:25-05:00
Output for 5.4.28
2014-09-12T23:12:24-05:00
Output for 5.4.1 - 5.4.21
2014-04-23T16:16:10-05:00
Output for 5.3.8 - 5.3.28, 5.4.0
2014-04-23T16:16:11-05:00
Output for 5.3.29
2014-09-12T23:12:26-05:00
Output for 5.3.0 - 5.3.7
2014-04-23T16:16:12-05:00
Output for 5.2.0 - 5.2.17
Fatal error: Class 'DateInterval' not found in /in/pkFIu on line 3
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/pkFIu 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/pkFIu 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/pkFIu on line 2