tzOffset() public method

Returns the time offset for local time zone.
public tzOffset ( boolean $colon = true ) : string
$colon boolean Place a colon between hours and minutes?
return string Timezone offset as a string in the format +HH:MM.
Exemplo n.º 1
0
 /**
  * Return the CURRENT offset from UTC for this station as provided by the
  * API.
  *
  * @return integer  The current offset from UTC.
  * @since 1.2.0
  */
 public function getOffset()
 {
     if (!empty($this->_properties['tz']) && is_numeric($this->_properties['tz'])) {
         return ($this->tz < 0 ? '-' : '') . gmdate('H:i', floor(abs($this->tz) * 60 * 60));
     } elseif (!empty($this->_properties['tz'])) {
         try {
             $d = new Horde_Date(time(), 'UTC');
             $d->setTimezone($this->tz);
             return $d->tzOffset();
         } catch (Horde_Date_Exception $e) {
         }
     }
     return false;
 }