note 98100 deleted from function.date-default-timezone-set by danbrown

From: Date: Wed, 26 May 2010 20:34:53 +0000
Subject: note 98100 deleted from function.date-default-timezone-set by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169633@lists.php.net to get a copy of this message
Note Submitter: Kenneth, K.T. ---- <?php function setTimezoneByOffset($required_offset) { $abbreviations_list = timezone_abbreviations_list(); foreach ($abbreviations_list as $abbr) { foreach ($abbr as $city) { try { $date = new DateTime('2010-12-21', new DateTimeZone($city['timezone_id'])); $offset = $date->getOffset() / 3600; if ($offset == $required_offset) { date_default_timezone_set($city['timezone_id']); return; } } catch (Exception $e) { continue; } } } } ?>

« previous php.notes (#169633) next »