Skip to content

Instantly share code, notes, and snippets.

@dgusoff
Created May 7, 2018 20:53
Show Gist options
  • Save dgusoff/49ff58c1891c554fad2e1b9e19c871fc to your computer and use it in GitHub Desktop.
Save dgusoff/49ff58c1891c554fad2e1b9e19c871fc to your computer and use it in GitHub Desktop.
calculate the date of Easter
private static DateTime Easter(int year)
{
int a = year%19;
int b = year/100;
int c = (b - (b/4) - ((8*b + 13)/25) + (19*a) + 15)%30;
int d = c - (c/28)*(1 - (c/28)*(29/(c + 1))*((21 - a)/11));
int e = d - ((year + (year/4) + d + 2 - b + (b/4))%7);
int month = 3 + ((e + 40)/44);
int day = e + 28 - (31*(month/4));
return new DateTime(year, month , day);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment