3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 - 7.1.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.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.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