/** * Calculates the Julian day of a date * * The calendar in which the date falls is automatically detected. * This algorithm is invalid for negative Julian days. * * @param int $year The year, for example: 2000, -1000, 0 * @param int $month The month, from 1 to 12 * @param float $day The day, from 1 to 31, or with decimals * @return float|bool The Julian day or false on error */ function aa_date_to_julian_day($year, $month, $day) { if (aa_is_gregorian_date($year, $month, $day)) { $julian_day = aa_gregorian_date_to_julian_day($year, $month, $day); } else { $julian_day = aa_julian_date_to_julian_day($year, $month, $day); } return $julian_day; }
/** * Finds if the year is a leap year * * The calendar in which the year falls is automatically detected. * * @param int $year The year, for example: 2000, -1000, 0 * @return boolean True if the year is a leap year, false otherwise */ function aa_is_leap_year($year) { if (aa_is_gregorian_date($year, 1, 1) === true) { $is_leap_year = aa_is_gregorian_leap_year($year); } else { $is_leap_year = aa_is_julian_leap_year($year); } return $is_leap_year; }
/** * Calculates the date of the Christian Easter for a given year * * The calendar in which the year falls is automatically detected. * * @param int $year The year, for example: 2000, -1000, 0 * @return array|bool The Easter date or false on error * @returns int 0 The year * @returns int 1 The month * @returns int 2 The day */ function aa_easter_date($year) { if (aa_is_gregorian_date($year, 1, 1) === true) { $easter_date = aa_gregorian_easter_date($year); } else { $easter_date = aa_julian_easter_date($year); } return $easter_date; }