PHP implementation method to calculate Easter date accurately

Source: Internet
Author: User
This article mainly introduces the method of PHP accurate calculation of Easter date, involving PHP operation date skills, very practical value, the need for friends can refer to the next

This example describes how PHP accurately calculates the Easter date. Share to everyone for your reference. Specific as follows:

<? Phpfunction Isleapyear ($nYEAR) {if (($nYEAR% 4 = = 0) and! ( $nYEAR% = = 0)) and ($nYEAR%. = 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 the 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 = 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 = ((one * $nGZ + + $nKORR-$nKSJ)% 30);  if ($nEPAKTE = = OR $nGZ = =) 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 > (59 + $NA) {$nNM = $nNM + 2-$nA;  } $nNM = $nNM + 91;  $nMONTH = P (* $nNM, 611)-2;  Day $nNT = $nN;  $nNT = $nN;  if ($nNT > ($nA)) {$nNT = $nNT + 2-$nA;  } $nNT = $nNT + 91;  $nM = P (* $nNT, 611);  $nDAY = $nNT-P (611 * $nM, 20); $dtEasterSunday = Mktime (0,0,0, $nMONTH, $nDAY, $nYEAR); } return $dtEasterSunday;}? >

Summary : The above is the entire content of this article, I hope to be able to help you learn.

Related recommendations:

Ways to parse HTML files using the Snoopy class

PHP methods for file manipulation and string encryption

PHP Delete, convert, group, sort for arrays

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.