3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date=(new \DateTime()); $date->setTimezone(new DateTimeZone('America/New_York')); echo $date->format('Y-m-d H:i:s');
Output for 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
2014-07-22 21:51:23
Output for 7.0.6
2016-05-02 20:55:09
Output for 7.0.5
2016-04-02 10:10:27
Output for 7.0.4
2016-03-09 19:45:39
Output for 7.0.3
2016-03-17 20:56:40
Output for 7.0.2
2016-03-21 07:30:45
Output for 7.0.1
2016-03-23 07:43:54
Output for 7.0.0
2016-03-26 10:09:46
Output for 5.6.21
2016-05-01 15:56:55
Output for 5.6.20
2016-04-09 05:22:23
Output for 5.6.19
2016-03-06 18:11:22
Output for 5.6.18
2016-03-14 07:22:59
Output for 5.6.17
2016-03-19 01:24:47
Output for 5.6.16
2016-03-27 10:53:48
Output for 5.6.15
2016-03-28 11:47:10
Output for 5.6.14
2016-04-01 14:24:05
Output for 5.6.13
2016-04-14 18:13:48
Output for 5.6.12
2016-04-19 07:23:55
Output for 5.6.11
2016-04-22 14:40:24
Output for 5.6.10
2016-04-24 16:19:44
Output for 5.6.9
2016-04-26 21:30:37
Output for 5.6.8
2016-04-29 05:07:22
Output for 5.6.7
2016-05-24 16:18:36
Output for 5.5.35
2016-05-21 19:21:05
Output for 5.5.34
2016-04-10 11:19:04
Output for 5.5.33
2016-03-08 06:36:04
Output for 5.5.32
2016-03-16 13:18:18
Output for 5.5.31
2016-03-20 04:17:20
Output for 5.5.30
2016-03-31 13:48:23
Output for 5.5.29
2016-04-16 08:20:59
Output for 5.5.28
2016-04-20 10:40:57
Output for 5.5.27
2016-04-21 13:10:31
Output for 5.5.26
2016-04-25 18:47:10
Output for 5.5.25
2016-04-28 00:47:14
Output for 5.5.24
2016-04-30 08:15:15
Output for 5.4.45
2015-09-21 05:53:06
Output for 5.4.44
2015-09-21 05:53:01
Output for 5.4.43
2015-09-20 22:09:28
Output for 5.4.42
2015-09-20 22:08:49
Output for 5.4.41
2015-09-20 22:08:21
Output for 5.4.40
2015-09-20 22:07:30
Output for 5.4.39
2015-09-20 22:06:42
Output for 5.4.38
2015-03-05 00:55:37
Output for 5.4.35 - 5.4.37
2015-03-05 00:55:30
Output for 5.4.34
2015-03-05 00:55:29
Output for 5.4.32
2014-09-13 19:08:42
Output for 5.4.31
2014-09-13 19:08:41
Output for 5.4.28 - 5.4.30
2014-07-22 21:51:26
Output for 5.4.6 - 5.4.27
2014-07-22 21:51:27
Output for 5.3.14 - 5.3.28, 5.4.0 - 5.4.5
2014-07-22 21:51:28
Output for 5.3.29
2014-09-13 19:08:39
Output for 5.3.0 - 5.3.13
2014-07-22 21:51:29
Output for 5.2.7 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QbNUX on line 2 2014-07-22 21:51:29
Output for 5.2.0 - 5.2.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QbNUX on line 2 2014-07-22 21:51:30
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/QbNUX on line 2 Fatal error: Class 'DateTime' not found in /in/QbNUX 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/QbNUX on line 2 Fatal error: Cannot instantiate non-existent class: datetime in /in/QbNUX 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/QbNUX on line 2 Fatal error: Cannot instantiate non-existent class: datetime in /in/QbNUX on line 2

preferences:
248.64 ms | 402 KiB | 314 Q