3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $offset = '+7:00'; // Calculate seconds from offset list($hours, $minutes) = explode(':', $offset); $seconds = $hours * 60 * 60 + $minutes * 60; // Get timezone name from seconds $tz = timezone_name_from_abbr('', $seconds, 1); // Workaround for bug #44780 if($tz === false) $tz = timezone_name_from_abbr('', $seconds, 0); // Set timezone date_default_timezone_set($tz); echo $tz . ': ' . date('r');
based on BDEtr
Output for 5.6.28, 7.0.20 - 7.2.0
Asia/Novosibirsk: Tue, 13 Oct 2015 10:29:58 +0600
Output for 5.4.34 - 5.4.45, 5.5.18 - 5.6.23, 7.0.0 - 7.0.8
Asia/Novosibirsk: Tue, 13 Oct 2015 10:29:57 +0600
Output for 5.4.0 - 5.4.32, 5.5.0 - 5.5.16
Asia/Novosibirsk: Tue, 13 Oct 2015 11:29:57 +0700