您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这篇文章主要介绍php如何准确计算复活节日期,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
具体如下:
<?PHP function isLeapYear( $nYEAR ) { if((($nYEAR % 4 == 0) AND !($nYEAR % 100 == 0)) AND ($nYEAR % 400 != 0)) { return TRUE; } else { return FALSE; } } function div( $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( 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 = (( 11 * $nGZ + 20 + $nKORR - $nKSJ ) % 30 ); if (( $nEPAKTE == 25 OR $nGZ == 11 ) AND $nEPAKTE == 24 ) { $nEPAKTE = $nEPAKTE + 1; } $nN = 44 - $nEPAKTE; 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 = div( 20 * $nNM, 611 ) - 2; // Day $nNT = $nN; $nNT = $nN; if ( $nNT > ( 59 + $nA )) { $nNT = $nNT + 2 - $nA; } $nNT = $nNT + 91; $nM = div( 20 * $nNT, 611 ); $nDAY = $nNT - div( 611 * $nM, 20 ); $dtEasterSunday = mktime( 0,0,0,$nMONTH,$nDAY,$nYEAR ); } return $dtEasterSunday; } ?>
以上是“php如何准确计算复活节日期”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。