Example #1
0
 public static function getInfo()
 {
     static $tz_info;
     if (!$tz_info) {
         $tz = Customization::get('timezone');
         $utc = new \DateTimeZone('UTC');
         $dt = new \DateTime('now', $utc);
         $current_tz = new \DateTimeZone($tz);
         $offset = $current_tz->getOffset($dt);
         $transition = $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp());
         $dt_in_tz = new \DateTime('now', $current_tz);
         $tz_info = array('code' => $tz, 'gmt_offset_seconds' => (double) $offset, 'gmt_offset_hours' => (double) ($offset / 3600), 'name' => $transition[0]['name'], 'abbr' => $transition[0]['abbr'], 'tz_object' => $current_tz, 'utc_object' => $utc, 'now_utc' => $dt, 'now' => $dt_in_tz);
     }
     return $tz_info;
 }