View script | License | Download script | History | Other scripts by: didec |
1-May 19:26 UTC
[0.044] 10.618k
[0.044] 10.618k
Archive version of: easter-day.r ... version: 1 ... didec 1-Mar-2005Amendment note: new script || Publicly available? Yes Rebol [ title: "Compute the date of Easter day" author: "Didier Cadieu, but many more" date: 25-feb-2005 version: 1.0.0 file: %easter-day.r purpose: { Just a small function to compute the date of the Easter day. Can be used to compute other dates related to Easter. Should be accurate for years starting at 1583 to 2050, and maybe more. } comment: { I have implemented this function from known algorithm. Many others have done the same (TomC, Allen Kamp...) I have just uploaded to the Library before them ;-) } library: [ level: 'beginner platform: 'all type: [function] domain: [math scientific] tested-under: [View 1.2.48.3.1 WinWP] support: none license: 'public-domain see-also: none ] ] easter-day: func [ {Compute the easter date for the wanted year.} year [integer!] {Year for whitch you want the easter date} /local a b c d z f g h i k l m n p ] [ a: year // 19 b: to integer! year / 100 c: year // 100 d: to integer! b / 4 z: b // 4 f: to integer! b + 8 / 25 g: to integer! b - f + 1 / 3 h: 19 * a + b - d - g + 15 // 30 i: to integer! c / 4 k: c // 4 l: 32 + (2 * z) + (2 * i) - h - k // 7 m: to integer! a + (11 * h) + (22 * l) / 451 n: to integer! h + l - (7 * m) + 114 / 31 p: h + l - (7 * m) + 114 // 31 to date! reduce [p + 1 n year] ] |