You are here

public static function PHPExcel_Shared_TimeZone::getTimeZoneAdjustment in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/TimeZone.php \PHPExcel_Shared_TimeZone::getTimeZoneAdjustment()

* 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 * *

Parameters

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

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/TimeZone.php, line 117

Class

PHPExcel_Shared_TimeZone
PHPExcel_Shared_TimeZone

Code

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;
}