3v4l.org

run code in 300+ PHP versions simultaneously
<?php //First we are setting the time to the current time, in the Chicago time zone $date = new DateTime(null, new DateTimeZone('America/Chicago')); //Then We are going to echo this information echo "<b>Chicago:</b> "; echo date_format($date, 'F jS Y H:i:s P') . "<br>"; //Now we are going to show the exact same time, the current time, for Madrid echo "<b>Madrid:</b> "; date_timezone_set($date, timezone_open('Europe/Madrid')); echo date_format($date, 'F jS Y H:i:s P') . "\n"; ?>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/KeWBM on line 5 <b>Chicago:</b> June 13th 2014 22:46:16 -05:00<br><b>Madrid:</b> June 14th 2014 05:46:16 +02:00
Output for 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
<b>Chicago:</b> June 13th 2014 22:46:16 -05:00<br><b>Madrid:</b> June 14th 2014 05:46:16 +02:00
Output for 7.0.6
<b>Chicago:</b> May 2nd 2016 20:53:24 -05:00<br><b>Madrid:</b> May 3rd 2016 03:53:24 +02:00
Output for 7.0.5
<b>Chicago:</b> April 2nd 2016 10:05:31 -05:00<br><b>Madrid:</b> April 2nd 2016 17:05:31 +02:00
Output for 7.0.4
<b>Chicago:</b> March 9th 2016 19:47:11 -06:00<br><b>Madrid:</b> March 10th 2016 02:47:11 +01:00
Output for 7.0.3
<b>Chicago:</b> March 17th 2016 21:01:16 -05:00<br><b>Madrid:</b> March 18th 2016 03:01:16 +01:00
Output for 7.0.2
<b>Chicago:</b> March 21st 2016 07:34:05 -05:00<br><b>Madrid:</b> March 21st 2016 13:34:05 +01:00
Output for 7.0.1
<b>Chicago:</b> March 23rd 2016 07:46:57 -05:00<br><b>Madrid:</b> March 23rd 2016 13:46:57 +01:00
Output for 7.0.0
<b>Chicago:</b> March 26th 2016 10:08:17 -05:00<br><b>Madrid:</b> March 26th 2016 16:08:17 +01:00
Output for 5.6.21
<b>Chicago:</b> May 1st 2016 15:57:18 -05:00<br><b>Madrid:</b> May 1st 2016 22:57:18 +02:00
Output for 5.6.20
<b>Chicago:</b> April 9th 2016 05:20:28 -05:00<br><b>Madrid:</b> April 9th 2016 12:20:28 +02:00
Output for 5.6.19
<b>Chicago:</b> March 6th 2016 18:31:57 -06:00<br><b>Madrid:</b> March 7th 2016 01:31:57 +01:00
Output for 5.6.18
<b>Chicago:</b> March 14th 2016 07:36:31 -05:00<br><b>Madrid:</b> March 14th 2016 13:36:31 +01:00
Output for 5.6.17
<b>Chicago:</b> March 19th 2016 01:30:38 -05:00<br><b>Madrid:</b> March 19th 2016 07:30:38 +01:00
Output for 5.6.16
<b>Chicago:</b> March 27th 2016 10:54:41 -05:00<br><b>Madrid:</b> March 27th 2016 17:54:41 +02:00
Output for 5.6.15
<b>Chicago:</b> March 28th 2016 11:47:08 -05:00<br><b>Madrid:</b> March 28th 2016 18:47:08 +02:00
Output for 5.6.14
<b>Chicago:</b> April 1st 2016 14:22:24 -05:00<br><b>Madrid:</b> April 1st 2016 21:22:24 +02:00
Output for 5.6.13
<b>Chicago:</b> April 14th 2016 18:19:39 -05:00<br><b>Madrid:</b> April 15th 2016 01:19:39 +02:00
Output for 5.6.12
<b>Chicago:</b> April 19th 2016 07:26:19 -05:00<br><b>Madrid:</b> April 19th 2016 14:26:19 +02:00
Output for 5.6.11
<b>Chicago:</b> April 22nd 2016 14:42:04 -05:00<br><b>Madrid:</b> April 22nd 2016 21:42:04 +02:00
Output for 5.6.10
<b>Chicago:</b> April 24th 2016 16:19:55 -05:00<br><b>Madrid:</b> April 24th 2016 23:19:55 +02:00
Output for 5.6.9
<b>Chicago:</b> April 26th 2016 21:32:33 -05:00<br><b>Madrid:</b> April 27th 2016 04:32:33 +02:00
Output for 5.6.8
<b>Chicago:</b> April 29th 2016 05:16:40 -05:00<br><b>Madrid:</b> April 29th 2016 12:16:40 +02:00
Output for 5.6.7
<b>Chicago:</b> May 24th 2016 17:01:49 -05:00<br><b>Madrid:</b> May 25th 2016 00:01:49 +02:00
Output for 5.5.35
<b>Chicago:</b> May 21st 2016 19:23:51 -05:00<br><b>Madrid:</b> May 22nd 2016 02:23:51 +02:00
Output for 5.5.34
<b>Chicago:</b> April 10th 2016 11:18:05 -05:00<br><b>Madrid:</b> April 10th 2016 18:18:05 +02:00
Output for 5.5.33
<b>Chicago:</b> March 8th 2016 06:41:55 -06:00<br><b>Madrid:</b> March 8th 2016 13:41:55 +01:00
Output for 5.5.32
<b>Chicago:</b> March 16th 2016 13:25:20 -05:00<br><b>Madrid:</b> March 16th 2016 19:25:20 +01:00
Output for 5.5.31
<b>Chicago:</b> March 20th 2016 04:22:11 -05:00<br><b>Madrid:</b> March 20th 2016 10:22:11 +01:00
Output for 5.5.30
<b>Chicago:</b> March 31st 2016 13:48:08 -05:00<br><b>Madrid:</b> March 31st 2016 20:48:08 +02:00
Output for 5.5.29
<b>Chicago:</b> April 16th 2016 08:21:47 -05:00<br><b>Madrid:</b> April 16th 2016 15:21:47 +02:00
Output for 5.5.28
<b>Chicago:</b> April 20th 2016 10:43:04 -05:00<br><b>Madrid:</b> April 20th 2016 17:43:04 +02:00
Output for 5.5.27
<b>Chicago:</b> April 21st 2016 13:10:12 -05:00<br><b>Madrid:</b> April 21st 2016 20:10:12 +02:00
Output for 5.5.26
<b>Chicago:</b> April 25th 2016 18:49:44 -05:00<br><b>Madrid:</b> April 26th 2016 01:49:44 +02:00
Output for 5.5.25
<b>Chicago:</b> April 28th 2016 00:50:09 -05:00<br><b>Madrid:</b> April 28th 2016 07:50:09 +02:00
Output for 5.5.24
<b>Chicago:</b> April 30th 2016 08:15:27 -05:00<br><b>Madrid:</b> April 30th 2016 15:15:27 +02:00
Output for 5.4.45
<b>Chicago:</b> September 20th 2015 17:14:51 -05:00<br><b>Madrid:</b> September 21st 2015 00:14:51 +02:00
Output for 5.4.44
<b>Chicago:</b> August 11th 2015 17:02:08 -05:00<br><b>Madrid:</b> August 12th 2015 00:02:08 +02:00
Output for 5.4.43
<b>Chicago:</b> August 11th 2015 17:02:03 -05:00<br><b>Madrid:</b> August 12th 2015 00:02:03 +02:00
Output for 5.4.42
<b>Chicago:</b> July 8th 2015 11:36:30 -05:00<br><b>Madrid:</b> July 8th 2015 18:36:30 +02:00
Output for 5.4.41
<b>Chicago:</b> May 25th 2015 23:34:13 -05:00<br><b>Madrid:</b> May 26th 2015 06:34:13 +02:00
Output for 5.4.39 - 5.4.40
<b>Chicago:</b> May 2nd 2015 00:54:50 -05:00<br><b>Madrid:</b> May 2nd 2015 07:54:50 +02:00
Output for 5.4.38
<b>Chicago:</b> February 28th 2015 15:39:20 -06:00<br><b>Madrid:</b> February 28th 2015 22:39:20 +01:00
Output for 5.4.37
<b>Chicago:</b> February 5th 2015 23:15:39 -06:00<br><b>Madrid:</b> February 6th 2015 06:15:39 +01:00
Output for 5.4.36
<b>Chicago:</b> February 5th 2015 23:15:38 -06:00<br><b>Madrid:</b> February 6th 2015 06:15:38 +01:00
Output for 5.4.34 - 5.4.35
<b>Chicago:</b> November 15th 2014 22:43:04 -06:00<br><b>Madrid:</b> November 16th 2014 05:43:04 +01:00
Output for 5.4.31 - 5.4.32
<b>Chicago:</b> September 3rd 2014 20:19:45 -05:00<br><b>Madrid:</b> September 4th 2014 03:19:45 +02:00
Output for 5.3.29, 5.4.30
<b>Chicago:</b> September 3rd 2014 20:19:42 -05:00<br><b>Madrid:</b> September 4th 2014 03:19:42 +02:00
Output for 5.4.23 - 5.4.29
<b>Chicago:</b> June 13th 2014 22:46:21 -05:00<br><b>Madrid:</b> June 14th 2014 05:46:21 +02:00
Output for 5.4.8 - 5.4.22
<b>Chicago:</b> June 13th 2014 22:46:22 -05:00<br><b>Madrid:</b> June 14th 2014 05:46:22 +02:00
Output for 5.3.21 - 5.3.28, 5.4.0 - 5.4.7
<b>Chicago:</b> June 13th 2014 22:46:23 -05:00<br><b>Madrid:</b> June 14th 2014 05:46:23 +02:00
Output for 5.3.6 - 5.3.20
<b>Chicago:</b> June 13th 2014 22:46:24 -05:00<br><b>Madrid:</b> June 14th 2014 05:46:24 +02:00
Output for 5.2.5 - 5.2.17, 5.3.0 - 5.3.5
<b>Chicago:</b> June 13th 2014 22:46:25 -05:00<br><b>Madrid:</b> June 14th 2014 05:46:25 +02:00
Output for 5.2.0 - 5.2.4
<b>Chicago:</b> June 13th 2014 22:46:26 -05:00<br><b>Madrid:</b> June 14th 2014 05:46:26 +02:00
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/KeWBM on line 5
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/KeWBM on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/KeWBM on line 5

preferences:
225.65 ms | 401 KiB | 314 Q