VB icon

Easter Sunday

Email
Submitted on: 4/1/2018 4:59:18 AM
By: Lothar Geyer 
Level: Intermediate
User Rating: Unrated
Compatibility: PHP 5.0
Views: 1421
 
     This algorithm calculates the date of Easter Sunday for a given year. So you can offer different contents on your webpage whether its lenten period or not.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Easter Sunday
// Description:This algorithm calculates the date of Easter Sunday for a given year. So you can offer different contents on your webpage whether its lenten period or not.
// By: Lothar Geyer
//**************************************

// calculate date of easter sunday for a given year
function easter($actYear) {
 $y = $actYear;
 $n = 5; $m = 24;
 $a = $y % 19; $b = $y % 4; $c = $y % 7;
 $d = (($a * 19) + $m) % 30;
 $e = (($b*2) + ($c*4) + ($d*6) + $n) % 7;
 $t = $d + $e + 22;
 if ($t > 31) {
 $t = $t - 31;
 if (($t==26) or (($t==25) && ($d==28) && ($a>10))) {
$t = $t - 7;
 };
 $m = 4;
 } else {
 $m = 3;
 };
 $em = mktime ( 0, 0, 0, $m, $t, $y );
 return $em;
}


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.