/** * Gets the difference of two date values in sfTime::YEAR * * @param $other mixed timestamp, string, or sfDate object * @return int the difference in the unit * @author Enrique Martinez <*****@*****.**> **/ public function diffYear($other) { $other_date = self::getInstance($other); $diff = $this->getYear() - $other_date->getYear(); $date_compare = new sfDate($other_date); $date_compare->addYear($diff); if ($diff > 0 && $date_compare->cmp($this) > 0) { $diff--; } if ($diff < 0 && $date_compare->cmp($this) < 0) { $diff++; } return $diff; }