Zend - The PHP Company




Calculators

Add Code


When is Eastern  

Type: code fragment
Added by: steinol
Entered: 09/01/2004
Last modified: 01/12/2003
Rating: - (fewer than 3 votes)
Views: 4367
simple function to calculate eastersunday. input is the year you wish calculate. output is the day of eastersunday and the eastermonth.


<?
function eastern($year){
  
$m = ((($year-$year%100)/100)-(($year-$year%400)/400)-(($year-$year%300)/300)+15)%30;
  
$n = ((($year-$year%100)/100)-(($year-$year%400)/400)+4)%7;
  
$a $year%19;
  
$b $year%4;
  
$c $year%7;
  
$d = (19*$a+$m)%30;
  
$e = (2*$b+4*$c+6*$d+$n)%7;
  
$eastersunday 22+$d+$e;
  
$eastermonth 3;
  if (
$eastersunday 31){
    
$eastersunday -= 31;
    
$eastermonth 4;
  }
  return 
substr(eastersundayeastermonth);
}
?>


Usage Example




Rate This Script





Search



This Category All Categories