Last active
August 29, 2015 14:05
-
-
Save CrazyMORF/6979b55e6dc823976b99 to your computer and use it in GitHub Desktop.
Easter Sunday
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static DateTime EasterSunday(int year) | |
{ | |
int day = 0; | |
int month = 0; | |
int g = year % 19; | |
int c = year / 100; | |
int h = (c - (int)(c / 4) - (int)((8 * c + 13) / 25) + 19 * g + 15) % 30; | |
int i = h - (int)(h / 28) * (1 - (int)(h / 28) * (int)(29 / (h + 1)) * (int)((21 - g) / 11)); | |
day = i - ((year + (int)(year / 4) + i + 2 - c + (int)(c / 4)) % 7) + 28; | |
month = 3; | |
if (day > 31) | |
{ | |
month++; | |
day -= 31; | |
} | |
return new DateTime(year, month, day); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment