The examples in this article describe how PHP accurately calculates the Easter date. Share to everyone for your reference. as follows:
? PHP function Isleapyear ($nYEAR) {if (($nYEAR% 4 = 0) and! (
$nYEAR% = 0)) and ($nYEAR%!= 0)) {return TRUE;
else {return FALSE; The function div ($a, $b) {return ($a-($a% $b))/$b;} function Eastersunday ($nYEAR) {//the function is able
To calculate the "date//of eastersunday" 325,//But Mktime () starts at 1970-01-01!
if ($nYEAR < 1970) {$dtEasterSunday = Mktime (1,1,1,1,1,1970);
else {$nGZ = ($nYEAR% 19) + 1;
$nJHD = div ($nYEAR, 100) + 1;
$nKSJ = div (3 * $nJHD, 4)-12;
$nKORR = div (8 * $nJHD + 5, 25)-5;
$nSO = div (5 * $nYEAR, 4)-$nKSJ-10;
$nEPAKTE = ((A * $nGZ + + $nKORR-$nKSJ)% 30);
if ($nEPAKTE = = or $nGZ = All) and $nEPAKTE = =) {$nEPAKTE = $nEPAKTE + 1;
} $nN = 44-$nEPAKTE;
if ($nN <) {$nN = $nN + 30;
$nN = $nN + 7-(($nSO + $nN)% 7);
$nN = $nN + isleapyear ($nYEAR);
$nN = $nN + 59;
$nA = Isleapyear ($nYEAR); Month $nNM = $nN;
if ($nNM > ($nA)) {$nNM = $nNM + 2-$nA;
} $nNM = $nNM + 91;
$nMONTH = div ($nNM, 611)-2;
Day $nNT = $nN;
$nNT = $nN;
if ($nNT > ($nA)) {$nNT = $nNT + 2-$nA;
} $nNT = $nNT + 91;
$nM = div ($nNT, 611);
$nDAY = $nNT-div (611 * $nM, 20);
$dtEasterSunday = Mktime (0,0,0, $nMONTH, $nDAY, $nYEAR);
return $dtEasterSunday; }?>
I hope this article will help you with your PHP programming.