How can I calculate what date Good Friday falls on, given a year?
问题 Does anyone have a good algorithm to calculate what date Good Friday falls on given the year as an input? Preferably in C#. 回答1: Here's a great article that should help you build your algorithm http://www.codeproject.com/KB/datetime/christianholidays.aspx Based on this example, you should be able to write: DateTime goodFriday = EasterSunday(DateTime.Now.Year).AddDays(-2); Full Example: public static DateTime EasterSunday(int year) { int day = 0; int month = 0; int g = year % 19; int c = year