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


PHP Zend_Date::getLocale方法代码示例

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


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

示例1: getMonthNames

 /**
  * Populates calendar's month names from translation list and caches them.
  *
  * @param array $format
  * @return array
  */
 public function getMonthNames(array $format = array())
 {
     if (empty($this->_monthNames)) {
         $months = Zend_Locale::getTranslationList('month', $this->_date->getLocale(), $format);
         foreach ($months as $month) {
             $this->_monthNames[] = $month;
         }
     }
     return $this->_monthNames;
 }
开发者ID:robjacoby,项目名称:xlr8u,代码行数:16,代码来源:Calendar.php

示例2: getPreparedStartDate

 /**
  * Prepare given time to fit the first timestamp of given intervall.
  *
  * E.g. INTERVALL_TYPE_MONTH, '2011-01-12 10:06:23' => '2011-01-01 00:00:00'
  *
  * Filter date if not in usable range:
  * 		too early	=>	set datetime to first flattened datetime value of measured data
  * 		in range	=>	ok
  * 		too late	=>	set datetime to last datetime value of measured data
  * 							AND call this method recursively for flattening this datetime to e.g. Monday 00:00
  *
  * @param Diagram_Model_IntervallMapper::INTERVALL_TYPE_*	$intervallType
  * @param string|timestamp|Zend_Date						$intervallStart
  * @return Zend_Date
  */
 public static function getPreparedStartDate($intervallType, $intervallStart)
 {
     /* @var $date Zend_Date */
     $date = null;
     if ($intervallStart instanceof Zend_Date) {
         $date = clone $intervallStart;
     } else {
         $date = new Zend_Date($intervallStart);
     }
     if ($date->isEarlier(self::getFirstMeasurementDate())) {
         $firstStartDate = new Zend_Date(self::getFirstMeasurementDate(), null, $date->getLocale());
         $date = self::getPreparedStartDate($intervallType, $firstStartDate);
     } elseif ($date->isLater(self::getLastMeasurementDate())) {
         $lastEndDate = new Zend_Date(self::getLastMeasurementDate(), null, $date->getLocale());
         $date = self::getPreparedStartDate($intervallType, $lastEndDate);
     }
     switch ($intervallType) {
         case self::INTERVALL_TYPE_YEAR:
             $date->setMonth(1);
         case self::INTERVALL_TYPE_MONTH:
             $date->setDay(1);
         case self::INTERVALL_TYPE_DAY:
             $date->setHour(0);
         case self::INTERVALL_TYPE_HOUR:
             $date->setMinute(0);
             $date->setSecond(0);
             break;
             // Doesn't fit with the others. Therefore handle separately.
         // Doesn't fit with the others. Therefore handle separately.
         case self::INTERVALL_TYPE_WEEK:
             // 1 == monday
             $date->setWeekday(1);
             $date->setHour(0);
             $date->setMinute(0);
             $date->setSecond(0);
     }
     return $date;
 }
开发者ID:JaXt0r,项目名称:EewAzVvE,代码行数:53,代码来源:IntervallMapper.php

示例3: testZF3677

 /**
  * Test for ZF-3677
  */
 public function testZF3677()
 {
     $locale = new Zend_Locale('de_AT');
     require_once 'Zend/Registry.php';
     Zend_Registry::set('Zend_Locale', $locale);
     $date = new Zend_Date('13', null, $locale);
     $this->assertSame($date->getLocale(), $locale->toString());
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:11,代码来源:DateTest.php

示例4: testSetLocale

 /**
  * test setLocale/getLocale
  */
 public function testSetLocale()
 {
     $date = new Zend_Date(0, 'de');
     $this->assertSame($date->getLocale(), 'de');
     $date->setLocale('en');
     $this->assertSame($date->getLocale(), 'en');
     $date->setLocale('en_XX');
     $this->assertSame($date->getLocale(), 'en');
     $date->setLocale('de_AT');
     $this->assertSame($date->getLocale(), 'de_AT');
     $locale = new Zend_Locale('ar');
     $date->setLocale($locale);
     $this->assertSame($date->getLocale(), 'ar');
     try {
         $date->setLocale('xx_XX');
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:23,代码来源:DateTest.php

示例5: testLocale

 /**
  * Test accessors for _Locale member property of Zend_Date
  */
 public function testLocale()
 {
     $date = new Zend_Date(Zend_Date::now());
     $locale = new Zend_Locale('en_Us');
     $set = $date->setLocale($locale);
     $this->assertSame($date->getLocale(), $set);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:10,代码来源:DateTest.php

示例6: datetime

 public static function datetime($timestamp, $part = null)
 {
     $date = new Zend_Date($timestamp, $part);
     $locale = $date->getLocale();
     return $date->toString(Zend_Locale_Data::getContent($locale, 'date', 'medium') . ' ' . Zend_Locale_Data::getContent($locale, 'time', 'short'));
 }
开发者ID:ei-grad,项目名称:phorm,代码行数:6,代码来源:Date.php


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