Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 public function getUnixTimestamp()
 {
     return parent::getUnixTimestamp();
 }
Ejemplo n.º 3
0
 /**
  * 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;
 }