/** * Compare this date to another date * * @param var $cmp * @return int equal: 0, date before $this: less than 0, date after $this: greater than zero */ public function compareTo($cmp) { return $cmp instanceof self ? $cmp->getTime() - $this->getTime() : -1; }