3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('America/Los_Angeles'); $local = new DateTimeZone('America/Los_Angeles'); /* $totSecs = $local->getOffset(new DateTime()); $totSecs -= .5 * 3600; $hrs = floor($totSecs / (60 * 60)); $mins = floor(($totSecs - $hrs * 60 * 60) / 60); echo $hrs . ':' . $mins; */ var_dump($local);
Output for 5.5.24 - 7.1.0
object(DateTimeZone)#1 (2) { ["timezone_type"]=> int(3) ["timezone"]=> string(19) "America/Los_Angeles" }
Output for 5.2.0 - 5.4.45
object(DateTimeZone)#1 (0) { }
Output for 5.1.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/T6SXX on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/T6SXX on line 2
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: date_default_timezone_set() in /in/T6SXX on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: date_default_timezone_set() in /in/T6SXX on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: date_default_timezone_set() in /in/T6SXX on line 2