Does anyone have a good algorithm to calculate what date Good Friday falls on given the year as an input? Preferably in C#.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Wikipedia knows: http://en.wikipedia.org/wiki/Good_Friday#Calculating_the_date
Necromancing.
Actually, it depends on whether it is Orthodox or Catholic Good Friday ;)
from https://mycodepad.wordpress.com/2013/04/28/c-calculating-orthodox-and-catholic-easter/
(Note: Easter = Easter Sunday)
Then you could still create an abstract EasterBunny:
With this abstract bunny here:
Is it possible to the use the Hebrew or Arabic lunar calendars for the conversion? eg:
Try this:
Logic ported from here: http://www.kenhamady.com/form25.shtml
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:
Full Example:
Don't Repeat Yourself
Think
Realize that calculating Easter is what you are really dependent upon.
Research
Here is the offical Naval Observatory page for calculating Easter.
http://aa.usno.navy.mil/faq/docs/easter.php
Execute
Use the formula for calculating Easter then shift to the previous Friday (or subtract 2 days, details up to you).