This article mainly introduces the php Method for accurately calculating the Easter date, which involves the php operation date technique and is very useful. For more information, see
This article mainly introduces the php Method for accurately calculating the Easter date, which involves the php operation date technique and is very useful. For more information, see
This article describes how php accurately calculates the Easter date. Share it with you for your reference. The details are as follows:
<? PHPfunction isLeapYear ($ nYEAR) {if ($ nYEAR % 4 = 0) AND! ($ NYEAR % 100 = 0) AND ($ nYEAR % 400! = 0) {return TRUE;} else {return FALSE;} function p ($ a, $ B) {return ($ a-($ a % $ B )) /$ B;} function easterSunday ($ nYEAR) {// The function is able to calculate the date // of eastersunday back to the year 325, // but mktime () starts at 1970-01-01! If ($ nYEAR <1970) {$ dtEasterSunday = mktime (,);} else {$ nGZ = ($ nYEAR % 19) + 1; $ nJHD = p ($ nYEAR, 100) + 1; $ nKSJ = p (3 * $ nJHD, 4)-12; $ nKORR = p (8 * $ nJHD + 5, 25)-5; $ nSO = p (5 * $ nYEAR, 4)-$ nKSJ-10; $ nEPAKTE = (11 * $ nGZ + 20 + $ nKORR-$ nKSJ) % 30); if ($ nEPAKTE = 25 OR $ nGZ = 11) AND $ nEPAKTE = 24) {$ nEPAKTE = $ nEPAKTE + 1;} $ nN = 44-$ nEP AKTE; if ($ nN <21) {$ nN = $ nN + 30;} $ nN = $ nN + 7-($ nSO + $ nN) % 7 ); $ nN = $ nN + isLeapYear ($ nYEAR); $ nN = $ nN + 59; $ nA = isLeapYear ($ nYEAR); // Month $ nNM = $ nN; if ($ nNM> (59 + $ nA) {$ nNM = $ nNM + 2-$ nA;} $ nNM = $ nNM + 91; $ nMONTH = p (20 * $ nNM, 611)-2; // Day $ nNT = $ nN; if ($ nNT> (59 + $ nA) {$ nNT = $ nNT + 2-$ nA;} $ nNT = $ nNT + 91; $ nM = p (20 * $ n NT, 611); $ nDAY = $ nNT-p (611 * $ nM, 20); $ dtEasterSunday = mktime (, 0, $ nMONTH, $ nDAY, $ nYEAR);} return $ dtEasterSunday;}?>
I hope this article will help you with php programming.
,