3v4l.org

run code in 300+ PHP versions simultaneously
<?php $theTime = time(); // specific date/time we're checking, in epoch seconds. $tz = new DateTimeZone('America/New_York'); $transition = $tz->getTransitions($theTime, $theTime); // only one array should be returned into $transition. Now get the data: $offset = $transition[0]['offset']; $abbr = $transition[0]['abbr']; echo $offset . ' - ' . $abbr;
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
-18000 - EST
Output for 5.2.0 - 5.2.17
Warning: DateTimeZone::getTransitions() expects exactly 0 parameters, 2 given in /in/uRZ1g on line 7 -
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/uRZ1g on line 6
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: datetimezone in /in/uRZ1g on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/uRZ1g on line 6

preferences:
258.03 ms | 401 KiB | 322 Q