• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/time.php
  • Класс: CTimeZone
  • Вызов: CTimeZone::GetZones
static function GetZones()
{
	IncludeModuleLangFile(__FILE__);

	$aTZ = array();
	static $aExcept = array("Etc/", "GMT", "UTC", "UCT", "HST", "PST", "MST", "CST", "EST", "CET", "MET", "WET", "EET", "PRC", "ROC", "ROK", "W-SU");
	foreach(DateTimeZone::listIdentifiers() as $tz)
	{
		foreach($aExcept as $ex)
			if(strpos($tz, $ex) === 0)
				continue 2;
		try
		{
			$oTz = new DateTimeZone($tz);
			$aTZ[$tz] = array('timezone_id'=>$tz, 'offset'=>$oTz->getOffset(new DateTime("now", $oTz)));
		}
		catch(Exception $e){}
	}

	uasort($aTZ, array('CTimeZone', '__tzsort'));

	$aZones = array(""=>GetMessage("tz_local_time"));
	foreach ($aTZ as $z)
	{
		$offset = '';
		if ($z['offset'] != 0)
		{
			$offset = ' ' . MainTypeDateTime::secondsToOffset($z['offset'], ':');
		}
		$aZones[$z['timezone_id']] = '(UTC' . $offset . ') ' . $z['timezone_id'];
	}

	return $aZones;
}