本文整理匯總了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");
}
}