Skip to content

Instantly share code, notes, and snippets.

@boblail
Created April 25, 2011 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boblail/941179 to your computer and use it in GitHub Desktop.
Save boblail/941179 to your computer and use it in GitHub Desktop.
Calculate the date of Easter given the year
public static DateTime FindEaster( int year ) {
int month, day, century, n, m, i, j, k, z, a, l;
century = year / 100;
n = year % 19;
m = (century - 17) / 25;
i = century - (century >> 2) - (int)((century - m) / 3) + 19 * n + 15;
j = i % 30;
z = (int)(j / 28);
k = j - z * (1 - z * (int)(29 / (j + 1)) * (int)((21 - n) / 11));
a = year + (year >> 2) + k + 2 - century + (century >> 2);
l = k - (a % 7);
month = 3 + ((l + 40) / 44);
day = l + 28 - 31 * (month >> 2);
return new DateTime( year, month, day );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment