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


PHP Zend_Date::format方法代码示例

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


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

示例1: frontend

 /**
  * @see Document\Tag\TagInterface::frontend
  */
 public function frontend()
 {
     if (!isset($this->options["format"]) || !$this->options["format"]) {
         $this->options["format"] = \DateTime::ISO8601;
     }
     if ($this->date instanceof \Zend_Date) {
         return $this->date->toString($this->options["format"], "php");
     } elseif ($this->date instanceof \DateTime) {
         return $this->date->format($this->options["format"]);
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:14,代码来源:Date.php

示例2: writeDate

 /**
  * Convert the DateTime into an AMF Date
  *
  * @param  DateTime|Zend_Date $data
  * @return Zend_Amf_Parse_Amf0_Serializer
  */
 public function writeDate($data)
 {
     if ($data instanceof DateTime) {
         $dateString = $data->format('U');
     } elseif ($data instanceof Zend_Date) {
         $dateString = $data->toString('U');
     } else {
         // // require_once 'Zend/Amf/Exception.php';
         throw new Zend_Amf_Exception('Invalid date specified; must be a DateTime or Zend_Date object');
     }
     $dateString *= 1000;
     // Make the conversion and remove milliseconds.
     $this->_stream->writeDouble($dateString);
     // Flash does not respect timezone but requires it.
     $this->_stream->writeInt(0);
     return $this;
 }
开发者ID:ahdail,项目名称:humhub,代码行数:23,代码来源:Serializer.php

示例3: writeDate

 /**
  * Convert DateTime/Zend_Date to AMF date
  *
  * @param  DateTime|Zend_Date $date
  * @return Zend_Amf_Parse_Amf3_Serializer
  */
 public function writeDate($date)
 {
     if ($date instanceof DateTime) {
         $dateString = $date->format('U') * 1000;
     } elseif ($date instanceof Zend_Date) {
         $dateString = $date->toString('U') * 1000;
     } else {
         require_once 'Zend/Amf/Exception.php';
         throw new Zend_Amf_Exception('Invalid date specified; must be a string DateTime or Zend_Date object');
     }
     $this->writeInteger(0x1);
     // write time to stream minus milliseconds
     $this->_stream->writeDouble($dateString);
     return $this;
 }
开发者ID:anunay,项目名称:stentors,代码行数:21,代码来源:Serializer.php

示例4: getVersionPreview

 /**
  * @see Object\ClassDefinition\Data::getVersionPreview
  * @param \Zend_Date|\DateTime $data
  * @param null|Object\AbstractObject $object
  * @param mixed $params
  * @return string
  */
 public function getVersionPreview($data, $object = null, $params = [])
 {
     if ($data instanceof \Zend_Date) {
         return $data->toString("Y-m-d H:i", "php");
     } elseif ($data instanceof \DateTime) {
         return $data->format("Y-m-d H:i");
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:15,代码来源:Datetime.php

示例5: getVersionPreview

 /**
  * @see Object\ClassDefinition\Data::getVersionPreview
  * @param \Zend_Date|\DateTime $data
  * @param null|Object\AbstractObject $object
  * @param mixed $params
  * @return string
  */
 public function getVersionPreview($data, $object = null, $params = [])
 {
     if ($data instanceof \Zend_Date) {
         return $data->get(\Zend_Date::DATE_MEDIUM);
     } elseif ($data instanceof \DateTimeInterface) {
         return $data->format("Y-m-d");
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:15,代码来源:Date.php


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