computus

How can I calculate what date Good Friday falls on, given a year?

馋奶兔 提交于 2019-11-30 06:26:16
问题 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

Function to return date of Easter for the given year

我的梦境 提交于 2019-11-28 18:18:18
So, here's a funny little programming challenge. I was writing a quick method to determine all the market holidays for a particular year, and then I started reading about Easter and discovered just how crazy* the logic is for determining its date--the first Sunday after the Paschal Full Moon following the spring equinox! Does anybody know of an existing function to calculate the date of Easter for a given year? Granted, it's probably not all that hard to do; I just figured I'd ask in case somebody's already done this. (And that seems very likely.) UPDATE : Actually, I'm really looking for the

Function to return date of Easter for the given year

非 Y 不嫁゛ 提交于 2019-11-27 11:12:14
问题 So, here's a funny little programming challenge. I was writing a quick method to determine all the market holidays for a particular year, and then I started reading about Easter and discovered just how crazy* the logic is for determining its date--the first Sunday after the Paschal Full Moon following the spring equinox! Does anybody know of an existing function to calculate the date of Easter for a given year? Granted, it's probably not all that hard to do; I just figured I'd ask in case