note 96714 deleted from function.easter-date by danbrown
| From: | danbrown@php.net | Date: | Fri, 12 Mar 2010 13:23:23 +0000 |
| Subject: | note 96714 deleted from function.easter-date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-166963@lists.php.net to get a copy of this message | ||
Note Submitter: aei at riga dot ahlers dot com
----
function calc_easter_date_western($year = NULL) {
// uses modified Oudin's method to calculate Western Easter date for the given year
// returns: date of Easter in unix time format
if (!$year) {
$year = date('Y');
}
$C = (int) ($year / 100);
$G = (int) ($year % 19);
$K = (int) (($C - 17) / 25);
$I = (int) (($C - (int) ($C / 4) - (int) (($C - $K) / 3) + 19 * $G + 15) % 30);
$I = $I - (int) ($I / 28) * (1 - (int) ($I / 28) * (int) (29 / ($I + 1)) * (int) ((21 - $G) /
11));
$J = (int) (($year + (int) ($year / 4) + $I + 2 - $C + (int) ($C / 4)) % 7);
$L = $I - $J;
$easter_month = 3 + (int) (($L + 40) / 44);
$easter_day = $L + 28 - 31 * (int) ($easter_month / 4);
$easter_utime = mktime(0, 0, 0, $easter_month, $easter_day, $year);
return $easter_utime;
}
function calc_easter_date_orthodox($year = NULL) {
// uses Gauss' method to calculate Orthodox Easter date for the given year
// from Julian Mar 1, 1900, to Julian Feb 29, 2100, the correction is to add 13 days to the Julian
date to
// obtain the Gregorian date
// returns: date of Easter in unix time format
if (!$year) {
$year = date('Y');
}
$G = $year % 19; // Golden Number-1
$I = (19 * $G + 15) % 30; // the number of days from 21 March to the Paschal full moon
$J = ($year + (int) ($year / 4) + $I) % 7; // the weekday for the Paschal full moon (0=Sunday,
1=Monday, etc.)
$L = $I - $J; // the number of days from 21 March to the Sunday on or before the Pascal Full Moon
(a number between -6 and 28)
$easter_month = 3 + (int) (($L + 40) / 44);
$easter_day = $L + 28 - 31 * (int) ($easter_month / 4);
$easter_utime = strtotime('+13 days', mktime(0, 0, 0, $easter_month, $easter_day,
$year));
return $easter_utime;
}