timestamp = strtotime($date); $this->format = $format; } /** * Object to string converter * * @return string */ public function __toString() { return date($this->format, $this->timestamp); } /** * Sets the date * * @param mixed $date Any valid strtotime() format. * @link http://www.php.net/strtotime */ public function set($date) { $this->timestamp = strtotime($date); } /** * Offsets the date by the provided offset (in seconds) * * @param int $offset */ public function offset($offset) { $this->timestamp += (int) $offset; } /** * Sets the date format * * @param sting $format Any valid date() format. * @link http://www.php.net/date */ public function setFormat($format) { $this->format = $format; } /** * Checks if the date is less than the supplied date * * @param mixed $date Any strtotime() format * @return boolean */ public function isLessThan($date) { return $this->timestamp < strtotime($date); } /** * Checks if the date is greater than the supplied date * * @param mixed $date Any strtotime() format * @return boolean */ public function isGreaterThan($date) { return $this->timestamp > strtotime($date); } }