当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Date::getTimezoneAlias方法代码示例

本文整理汇总了PHP中Horde_Date::getTimezoneAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Date::getTimezoneAlias方法的具体用法?PHP Horde_Date::getTimezoneAlias怎么用?PHP Horde_Date::getTimezoneAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Date的用法示例。


在下文中一共展示了Horde_Date::getTimezoneAlias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTimezone

 /**
  * Attempt to guess the timezone identifier from the $offsets array.
  *
  * Since it's impossible to know exactly which olson timezone name a
  * specific set of offsets represent (multiple timezone names may be
  * described by the same offsets for any given year) we allow passing an
  * expected timezone. If this matches one of the timezones that matches the
  * offsets, we return that. Otherwise, we attempt to get the full timezone
  * name from Horde_Date and if that fails, return the abbreviated timezone
  * name of the first timezone that matches the provided offsets.
  *
  * @param array|string $offsets     The timezone to check. Either an array
  *                                  of offsets or an activesynz tz blob.
  * @param string $expectedTimezone  The expected timezone. If not empty, and
  *                                  present in the results, will return.
  *
  * @return string  The timezone identifier.
  */
 public function getTimezone($offsets, $expectedTimezone = null)
 {
     $timezones = $this->getListOfTimezones($offsets, $expectedTimezone);
     if (isset($timezones[$expectedTimezone])) {
         return $expectedTimezone;
     } else {
         return Horde_Date::getTimezoneAlias(current($timezones));
     }
 }
开发者ID:horde,项目名称:horde,代码行数:27,代码来源:Timezone.php

示例2: testGetTimezoneAlias

 public function testGetTimezoneAlias()
 {
     $this->assertEquals('Europe/Berlin', Horde_Date::getTimezoneAlias('W. Europe Standard Time'));
     $this->assertEquals('Europe/Berlin', Horde_Date::getTimezoneAlias('W. Europe'));
     $this->assertEquals('Europe/Berlin', Horde_Date::getTimezoneAlias('CET'));
     $this->assertEquals('UTC', Horde_Date::getTimezoneAlias('UTC'));
 }
开发者ID:horde,项目名称:horde,代码行数:7,代码来源:DateTest.php

示例3: getZone

 /**
  * Returns an object representing an invidual timezone.
  *
  * Maps to a "Zone" entry in the timezone database. Works with
  * zone aliases and other common timezone names too.
  *
  * @param string $zone  A timezone name.
  *
  * @return Horde_Timezone_Zone  A timezone object.
  */
 public function getZone($zone)
 {
     if (!$this->_zones) {
         $this->_extractAndParse();
     }
     $zone = Horde_Date::getTimezoneAlias($zone);
     $alias = isset($this->_links[$zone]) ? $this->_links[$zone] : $zone;
     if (!isset($this->_zones[$alias])) {
         throw new Horde_Timezone_Exception(sprintf('Timezone %s not found', $zone));
     }
     $this->_zones[$alias]->setTzid($zone);
     return $this->_zones[$alias];
 }
开发者ID:horde,项目名称:horde,代码行数:23,代码来源:Timezone.php


注:本文中的Horde_Date::getTimezoneAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。