How to get the easter day(php求复活节日期)

之前项目上用到的,存档一下!
function getEsterDay($y){//$y当前年份 如2012
			
		$a = $y%19;
		$b = intval($y/100);
		$c = $y%100;
		$d = intval($b/4);
		$e = $b%4;
		$f = intval(($b+8)/25);
		$g = intval(($b-$f+1)/3);
		$h = (19*$a+$b-$d-$g+15)%30;
		$i = intval($c/4);
		$k = $c%4;
		$l = (32+2*$e+2*$i-$h-$k)%7;
		$m = intval(($a+11*$h+22*$l)/451);
		$p = ($h+$l-7*$m+114)%31;
		$month = intval(($h+$l-7*$m+114)/31);    // [3 = March, 4 = April]
		$day = $p+1; 
			
		if (strlen($month) == 1) {
			$month = "0". $month;
		}
		if (strlen($day) == 1) {
			$day = "0". $day;
		}
		return  $y ."/". $month ."/". $day;	
}


你可能感兴趣的:(c,PHP,function)