Find Easter Sunday of any year

Find Easter Sunday of any year
The Meeus/Jones/Butcher Gregorian algorithm is used for calculating the Easter Sunday of any given year using C#.
1. // Finds the Easter Sunday of the passed year
2. public static DateTime EasterSundayOf(int YearToCheck)
3. {
4.     int Y = YearToCheck;
5.     int a = Y % 19;
6.     int b = Y / 100;
7.     int c = Y % 100;
8.     int d = b / 4;
9.     int e = b % 4;
10.    int f = (b + 8) / 25;
11.    int g = (b - f + 1) / 3;
12.    int h = (19 * a + b - d - g + 15) % 30;
13.    int i = c / 4;
14.    int k = c % 4;
15.    int L = (32 + 2 * e + 2 * i - h - k) % 7;
16.    int m = (a + 11 * h + 22 * L) / 451;
17.    int Month = (h + L - 7 * m + 114) / 31;
18.    int Day = ((h + L - 7 * m + 114) % 31) + 1;
19.    DateTime dtEasterSunday = new DateTime(YearToCheck, Month, Day);
20.    return dtEasterSunday;
21.}

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top