當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。