本文整理汇总了PHP中Zend_Date::getUnixTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::getUnixTimestamp方法的具体用法?PHP Zend_Date::getUnixTimestamp怎么用?PHP Zend_Date::getUnixTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::getUnixTimestamp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toTimestamp
/**
* Convert date to UNIX timestamp
* Returns current UNIX timestamp if date is true
*
* @param Zend_Date|string|true $date
* @return int
*/
public static function toTimestamp($date)
{
if ($date instanceof Zend_Date) {
return $date->getUnixTimestamp();
}
if ($date === true) {
return time();
}
return strtotime($date);
}
示例2: getUnixTimestamp
public function getUnixTimestamp()
{
return parent::getUnixTimestamp();
}
示例3: diffSeconds
/**
* The number of seconds in $date subtracted from $this.
*
* Zero when both date/times occur on the same second.
* POSITIVE when $date is YOUNGER than $this
* Negative when $date is older than $this
*
* @param \Zend_Date $date Date or now
* @param \Zend_Locale $locale optional (not used)
* @return type
*/
public function diffSeconds(\Zend_Date $date = null, $locale = null)
{
$val1 = $this->getUnixTimestamp();
if (null == $date) {
$val2 = time();
} else {
$val2 = $date->getUnixTimestamp();
}
return $val1 - $val2;
}