3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function format($timezone) { $d = new \DateTime('now', new \DateTimeZone($timezone)); return $d->format('Y-m-d H:i:s.u ' . ($d->getTimeZone()->getLocation() ? 'e (P)' : 'P')); } echo format('Europe/Paris') . PHP_EOL; echo format('UTC') . PHP_EOL; echo format('+02:00') . PHP_EOL; echo format('GMT+2') . PHP_EOL;
based on Yo88W
Output for 7.3.1
2017-05-02 18:21:05.061728 Europe/Paris (+02:00) 2017-05-02 16:21:05.061803 UTC (+00:00) 2017-05-02 18:21:05.061830 +02:00 2017-05-02 18:21:05.061838 +02:00
Output for 7.3.0
2017-05-02 18:21:05.043284 Europe/Paris (+02:00) 2017-05-02 16:21:05.043345 UTC (+00:00) 2017-05-02 18:21:05.043359 +02:00 2017-05-02 18:21:05.043369 +02:00
Output for 7.2.13
2017-05-02 18:21:05.087388 Europe/Paris (+02:00) 2017-05-02 16:21:05.087450 UTC (+00:00) 2017-05-02 18:21:05.087460 +02:00 2017-05-02 18:21:05.087467 +02:00
Output for 7.2.12
2017-05-02 18:21:06.052876 Europe/Paris (+02:00) 2017-05-02 16:21:06.052971 UTC (+00:00) 2017-05-02 18:21:06.052988 +02:00 2017-05-02 18:21:06.053002 +02:00
Output for 7.2.11
2017-05-02 18:21:05.096209 Europe/Paris (+02:00) 2017-05-02 16:21:05.096301 UTC (+00:00) 2017-05-02 18:21:05.096317 +02:00 2017-05-02 18:21:05.096328 +02:00
Output for 7.2.10
2017-05-02 18:21:05.118528 Europe/Paris (+02:00) 2017-05-02 16:21:05.118620 UTC (+00:00) 2017-05-02 18:21:05.118646 +02:00 2017-05-02 18:21:05.118655 +02:00
Output for 7.2.9
2017-05-02 18:21:05.189927 Europe/Paris (+02:00) 2017-05-02 16:21:05.190012 UTC (+00:00) 2017-05-02 18:21:05.190026 +02:00 2017-05-02 18:21:05.190035 +02:00
Output for 7.2.8
2017-05-02 18:21:05.096867 Europe/Paris (+02:00) 2017-05-02 16:21:05.096942 UTC (+00:00) 2017-05-02 18:21:05.096951 +02:00 2017-05-02 18:21:05.096956 +02:00
Output for 7.2.7
2017-05-02 18:21:05.000247 Europe/Paris (+02:00) 2017-05-02 16:21:05.000307 UTC (+00:00) 2017-05-02 18:21:05.000323 +02:00 2017-05-02 18:21:05.000336 +02:00
Output for 7.2.6
2017-05-02 18:21:05.081523 Europe/Paris (+02:00) 2017-05-02 16:21:05.081617 UTC (+00:00) 2017-05-02 18:21:05.081635 +02:00 2017-05-02 18:21:05.081646 +02:00
Output for 7.2.5
2017-05-02 18:21:05.333787 Europe/Paris (+02:00) 2017-05-02 16:21:05.333912 UTC (+00:00) 2017-05-02 18:21:05.333960 +02:00 2017-05-02 18:21:05.333986 +02:00
Output for 7.2.4
2017-05-02 18:21:05.204878 Europe/Paris (+02:00) 2017-05-02 16:21:05.204942 UTC (+00:00) 2017-05-02 18:21:05.204950 +02:00 2017-05-02 18:21:05.204955 +02:00
Output for 7.2.3
2017-05-02 18:21:05.219086 Europe/Paris (+02:00) 2017-05-02 16:21:05.219199 UTC (+00:00) 2017-05-02 18:21:05.219216 +02:00 2017-05-02 18:21:05.219228 +02:00
Output for 7.2.2
2017-05-02 18:21:05.160135 Europe/Paris (+02:00) 2017-05-02 16:21:05.160271 UTC (+00:00) 2017-05-02 18:21:05.160291 +02:00 2017-05-02 18:21:05.160311 +02:00
Output for 7.2.1
2017-05-02 18:21:05.000159 Europe/Paris (+02:00) 2017-05-02 16:21:05.000202 UTC (+00:00) 2017-05-02 18:21:05.000210 +02:00 2017-05-02 18:21:05.000215 +02:00
Output for 7.2.0
2017-05-02 18:21:05.064195 Europe/Paris (+02:00) 2017-05-02 16:21:05.064312 UTC (+00:00) 2017-05-02 18:21:05.064331 +02:00 2017-05-02 18:21:05.064343 +02:00
Output for 7.1.25
2017-05-02 18:21:05.041379 Europe/Paris (+02:00) 2017-05-02 16:21:05.041444 UTC (+00:00) 2017-05-02 18:21:05.041457 +02:00 2017-05-02 18:21:05.041466 +02:00
Output for 7.1.20
2017-05-02 18:21:05.002058 Europe/Paris (+02:00) 2017-05-02 16:21:05.002095 UTC (+00:00) 2017-05-02 18:21:05.002102 +02:00 2017-05-02 18:21:05.002106 +02:00
Output for 7.1.7
2017-05-02 18:21:05.003433 Europe/Paris (+02:00) 2017-05-02 16:21:05.003466 UTC (+00:00) 2017-05-02 18:21:05.003474 +02:00 2017-05-02 18:21:05.003482 +02:00
Output for 7.1.6
2017-05-02 18:21:05.005173 Europe/Paris (+02:00) 2017-05-02 16:21:05.005200 UTC (+00:00) 2017-05-02 18:21:05.005207 +02:00 2017-05-02 18:21:05.005211 +02:00
Output for 7.1.5
2017-05-02 18:21:05.006879 Europe/Paris (+02:00) 2017-05-02 16:21:05.006924 UTC (+00:00) 2017-05-02 18:21:05.006934 +02:00 2017-05-02 18:21:05.006940 +02:00
Output for 7.1.4
2017-05-02 18:21:05.007319 Europe/Paris (+02:00) 2017-05-02 16:21:05.007358 UTC (+00:00) 2017-05-02 18:21:05.007365 +02:00 2017-05-02 18:21:05.007370 +02:00
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20, 7.1.3
2017-05-02 18:21:05.000000 Europe/Paris (+02:00) 2017-05-02 16:21:05.000000 UTC (+00:00) 2017-05-02 18:21:05.000000 +02:00 2017-05-02 18:21:05.000000 +02:00
Output for 7.1.2
2017-05-02 18:21:05.006742 Europe/Paris (+02:00) 2017-05-02 16:21:05.006768 UTC (+00:00) 2017-05-02 18:21:05.006773 +02:00 2017-05-02 18:21:05.006776 +02:00
Output for 7.1.1
2017-05-02 18:21:05.006690 Europe/Paris (+02:00) 2017-05-02 16:21:05.006742 UTC (+00:00) 2017-05-02 18:21:05.006753 +02:00 2017-05-02 18:21:05.006763 +02:00
Output for 7.1.0
2017-05-02 18:21:05.003018 Europe/Paris (+02:00) 2017-05-02 16:21:05.003044 UTC (+00:00) 2017-05-02 18:21:05.003049 +02:00 2017-05-02 18:21:05.003052 +02:00
Output for hhvm-3.12.14, hhvm-3.17.3
2017-05-02 18:21:05.000000 Europe/Paris (+02:00) 2017-05-02 16:21:05.000000 UTC (+00:00) Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+02:00)' in /in/uqc19:5 Stack trace: #0 /in/uqc19(5): DateTimeZone->__construct() #1 /in/uqc19(12): format() #2 {main}
Process exited with code 255.
Output for hhvm-3.15.4
2017-05-02 18:21:06.000000 Europe/Paris (+02:00) 2017-05-02 16:21:06.000000 UTC (+00:00) Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+02:00)' in /in/uqc19:5 Stack trace: #0 /in/uqc19(5): DateTimeZone->__construct() #1 /in/uqc19(12): format() #2 {main}
Process exited with code 255.