public static function weeksInYear($year) { // Find the last Thursday of the year. $date = new Horde_Date($year . '-12-31'); while ($date->dayOfWeek() != self::DATE_THURSDAY) { --$date->mday; } return $date->weekOfYear(); }