/** * 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); }
public function getUnixTimestamp() { return parent::getUnixTimestamp(); }
/** * 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; }