getTransitions(); $transitions = array(); foreach ($allTransitions as $key => $transition) { if ($transition['ts'] > $timestamp) { $transitions[] = ($key > 0) ? $allTransitions[$key - 1] : $transition; break; } if (empty($transitions)) { $transitions[] = end($allTransitions); } } return $transitions; } /** * Return the Timezone offset used for date/time conversions to/from UST * This requires both the timezone and the calculated date/time to allow for local DST * * @param string $timezone The timezone for finding the adjustment to UST * @param integer $timestamp PHP date/time value * @return integer Number of seconds for timezone adjustment * @throws PHPExcel_Exception */ public static function getTimeZoneAdjustment($timezone, $timestamp) { if ($timezone !== null) { if (!self::_validateTimezone($timezone)) { throw new PHPExcel_Exception("Invalid timezone " . $timezone); } } else { $timezone = self::$_timezone; } if ($timezone == 'UST') { return 0; } $objTimezone = new DateTimeZone($timezone); if (version_compare(PHP_VERSION, '5.3.0') >= 0) { $transitions = $objTimezone->getTransitions($timestamp, $timestamp); } else { $transitions = self::_getTimezoneTransitions($objTimezone, $timestamp); } return (count($transitions) > 0) ? $transitions[0]['offset'] : 0; } }