本文整理汇总了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"]);
}
}
示例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;
}
示例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;
}
示例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");
}
}
示例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");
}
}