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

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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; }
      }
   }
}
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.