Easter is a rather tricky beast to calculate. It is usually the first Sunday after the fourteenth day after the first new moon after the Vernal Equinox (March 21st). Quite a mouthful that.
There have been numerous ways worked out to find the date. The method listed below is an adaptation of the method appearing in Butcher’s Ecclesiastical Calendar in 1876. It works for the Gregorian calendar, so cannot be used to find dates before 1583.
public static DateTime CalcEasterDate(int piYear)
{
DateTime dEaster = new DateTime();
double iA;
double iB;
double iC;
double iD;
double iE;
double iFA;
double iG;
double iH;
double iK;
double iI;
double iL;
double iM;
double iNA;
double iP;
iA = (piYear % 19);
iB = Math.Floor(piYear / 100.0);
iC = (piYear % 100);
iD = Math.Floor(iB / 4.0);
iE = (iB % 4);
iFA = Math.Floor((iB +8) / 25.0);
iG = Math.Floor((iB - iFA + 1) / 3);
iH = ((19 * iA) + iB - iD - iG + 15) % 30;
iI = Math.Floor(iC / 4.0);
iK = (iC % 4);
iL = (32 + (2 * iE) + (2 * iI) - iH - iK) % 7;
iM = Math.Floor((iA + (11 * iH) + (22 * iL)) / 451.0);
iNA = Math.Floor((iH + iL - (7 * iM) + 114) / 31.0);
iP = (iH + iL - (7 * iM) + 114) % 31;
dEaster = new DateTime(piYear, Convert.ToInt16(iNA), Convert.ToInt16(iP + 1));
return dEaster;
}
Related posts:
- Astronomical calculations in C#: The Julian day The Julian day is the standard form of reporting the...
- Astronomy calculations in C#: Getting the age of the Moon Here we are not going to try find the actual...
- Astronomical calculations in C#: Calculating the phase of a planet Once we know how to find the position of the...
- Astronomical calculations in C#: Calculating the Moon phase Once we have Moon’s position, as we did in the...
- Astronomical calculations in C#: Calculating the distance to the Moon Like with what we did the Moon phase, the method...
Related posts brought to you by Yet Another Related Posts Plugin.
Serge Meunier is a software developer living in Cape Town, South Africa. He loves programming, fencing, philosophy, feeding his internet addiction, and, of course, dogs.
Comments