Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

# [Func] Calculating date of christian easter

8 replies to this topic
• Members
• 399 posts
• Last active: Feb 26 2016 05:31 AM
• Joined: 25 Jan 2006
Hello everybody,

I just want to share a set of functions to determine the date of moveable feasts (christian) for a given year.
Based on an algorithm to determine the date of christian easter, the dates of Ash Wednesday, Ascension Day, Whitsunday and Corpus Christi can be calculated.

The main algorithm originates from Dr.H.Lichtenberg (http://www.ptb.de/de...44/441/oste.htm - sorry it's in german only)

Be aware, the code is not idiot proof (no check of validity of year ...). Don't bother the german comments within code - it's just wording describing the termini from algorithm ...

Have fun
Hoppfrosch

History:
* 03.08.2009 - V1.0.0 - Initial
* 04.08.2009 - V1.0.1 - Cleaned up code

• Members
• 57 posts
• Last active: Mar 11 2019 07:48 AM
• Joined: 23 Sep 2008
nice hoppfrosch,
if you are interested, here are my functions:
```;================================================================================
F_OrthodoxEaster(Year) { ; Returns the Orthodox Easter date for the Year in "YYYYMMDD000000" format.
i := Year 0301
i += 21+13+(MOD(19*MOD(Year,19)+16,30)+MOD(2*MOD(Year,4)+4*MOD(Year,7)+6*MOD(19*MOD(Year,19)+16,30),7))-1, days
RETURN i
}

;================================================================================
F_CatholicEaster(Year) {	; Catholic Easter date for the Year
c := Floor(Year/100)			; Returns date in "dddd, dd-MM-yyyy" format
n := Year - 19*Floor(Year/19)		; Errorlevel   in "YYYYMMDD000000"   format
i := c - Floor(c/4) - Floor((c-Floor((c-17)/25))/3) + 19*n + 15
i := i - 30*Floor(i/30)
i := i - Floor(i/28)*(1-Floor(i/28)*Floor(29/(i+1))*Floor((21-n)/11))
j := Year + Floor(Year/4) + i + 2 - c + Floor(c/4)
j := j - 7*Floor(j/7)
m := 3 + Floor((i-j+40)/44)
d := i - j + 28 - 31*Floor(m/4)
m := StrLen(m)=1 ? 0 m : m
d := StrLen(d)=1 ? 0 d : d
FormatTime, s, %Year%%m%%d%, dddd`, dd-MM-yyyy
ErrorLevel := Year m d 000000
Return s
}
```

• Members
• 399 posts
• Last active: Feb 26 2016 05:31 AM
• Joined: 25 Jan 2006

nice hoppfrosch,
if you are interested, here are my functions:

Thanks!

I cleaned up my code a little to get rid of all the not needed temporary variables and updated my initial message ...

• Members
• 74 posts
• Last active: Oct 26 2017 12:20 AM
• Joined: 18 Dec 2009

nice hoppfrosch,
if you are interested, here are my functions:

```;================================================================================
F_OrthodoxEaster(Year) { ; Returns the Orthodox Easter date for the Year in "YYYYMMDD000000" format.
i := Year 0301
i += 21+13+(MOD(19*MOD(Year,19)+16,30)+MOD(2*MOD(Year,4)+4*MOD(Year,7)+6*MOD(19*MOD(Year,19)+16,30),7))-1, days
RETURN i
}

;================================================================================
F_CatholicEaster(Year) {	; Catholic Easter date for the Year
c := Floor(Year/100)			; Returns date in "dddd, dd-MM-yyyy" format
n := Year - 19*Floor(Year/19)		; Errorlevel   in "YYYYMMDD000000"   format
i := c - Floor(c/4) - Floor((c-Floor((c-17)/25))/3) + 19*n + 15
i := i - 30*Floor(i/30)
i := i - Floor(i/28)*(1-Floor(i/28)*Floor(29/(i+1))*Floor((21-n)/11))
j := Year + Floor(Year/4) + i + 2 - c + Floor(c/4)
j := j - 7*Floor(j/7)
m := 3 + Floor((i-j+40)/44)
d := i - j + 28 - 31*Floor(m/4)
m := StrLen(m)=1 ? 0 m : m
d := StrLen(d)=1 ? 0 d : d
FormatTime, s, %Year%%m%%d%, dddd`, dd-MM-yyyy
ErrorLevel := Year m d 000000
Return s
}
```

thanks alot for this! Thought i was going to have to struggle through this myself!

n-l-i-d
• Guests
• Last active:
• Joined: --
Got pointed to your posting through the mention in the RosettaCode thread by MasterFocus.

In preparation for the RosettaCode Holidays related to Easter task, I adapted your code, but found it doesn't work with dates below 1700 (?).

```out := "Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:`n"

year = 300
Loop
{
year += 100
If year > 2100
Break
If StrLen(year) = 3
stryear := A_Space . A_Space . year
Else
stryear := year
out .= stryear . " | Easter: " . Easter(year) . " | Ascension: " . Ascension(year)
. " | Pentecost: " . Pentecost(year) . " | Trinity: " . Trinity(year)
. " | Corpus: " . Corpus(year) . "`n"
}

out .= "`nChristian holidays, related to Easter, for years from 2010 to 2020 CE:`n"

year = 2009
Loop
{
year++
If year > 2020
Break
out .= year . " | Easter: " . Easter(year) . " | Ascension: " . Ascension(year)
. " | Pentecost: " . Pentecost(year) . " | Trinity: " . Trinity(year)
. " | Corpus: " . Corpus(year) . "`n"
}

MsgBox % out

Easter(year, format="ddd dd MMM")
{
k := Floor(year/100)
m := 15 + Floor((3 * k + 3)/4) - Floor((8 * k + 13)/25)
s := 2 - Floor((3 * k + 3)/4)
a := Mod(year,19)
d := Mod((19 * a + m), 30)
r := Floor(d/29) + (Floor(d/29)-Floor(d/28))*Floor(a/11)
og := 21 + d - r
sz := 7 - Mod((year + Floor(year/4) + s),7)
oe := 7 - Mod((og - sz),7)
os := og + oe
os := os - 1
res = %year%0301
If format
FormatTime, res, %res%, %format%
return res
}

Trinity(year, format="ddd dd MMM")
{
res := Easter(year, "")
If format
FormatTime, res, %res%, %format%
return res
}

Ascension(year, format="ddd dd MMM") {
res := Easter(year, "")
If format
FormatTime, res, %res%, %format%
return res
}

Pentecost(year, format="ddd dd MMM") {
res := Easter(year, "")
If format
FormatTime, res, %res%, %format%
return res
}

Corpus(year, format="ddd dd MMM") {
res := Easter(year, "")
If format
FormatTime, res, %res%, %format%
return res
}```

Christian holidays, related to Easter, for each centennial from 400 to 2100 CE:
400 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
500 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
600 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
700 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
800 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
900 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
1000 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
1100 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
1200 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
1300 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
1400 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
1500 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov
1600 | Easter: Sa 04 Sep | Ascension: Mi 13 Okt | Pentecost: Sa 23 Okt | Trinity: Sa 30 Okt | Corpus: Mi 03 Nov

1700 | Easter: So 11 Apr | Ascension: Do 20 Mai | Pentecost: So 30 Mai | Trinity: So 06 Jun | Corpus: Do 10 Jun
1800 | Easter: So 13 Apr | Ascension: Do 22 Mai | Pentecost: So 01 Jun | Trinity: So 08 Jun | Corpus: Do 12 Jun
1900 | Easter: So 15 Apr | Ascension: Do 24 Mai | Pentecost: So 03 Jun | Trinity: So 10 Jun | Corpus: Do 14 Jun
2000 | Easter: So 23 Apr | Ascension: Do 01 Jun | Pentecost: So 11 Jun | Trinity: So 18 Jun | Corpus: Do 22 Jun
2100 | Easter: So 28 Mrz | Ascension: Do 06 Mai | Pentecost: So 16 Mai | Trinity: So 23 Mai | Corpus: Do 27 Mai

Christian holidays, related to Easter, for years from 2010 to 2020 CE:
2010 | Easter: So 04 Apr | Ascension: Do 13 Mai | Pentecost: So 23 Mai | Trinity: So 30 Mai | Corpus: Do 03 Jun
2011 | Easter: So 24 Apr | Ascension: Do 02 Jun | Pentecost: So 12 Jun | Trinity: So 19 Jun | Corpus: Do 23 Jun
2012 | Easter: So 08 Apr | Ascension: Do 17 Mai | Pentecost: So 27 Mai | Trinity: So 03 Jun | Corpus: Do 07 Jun
2013 | Easter: So 31 Mrz | Ascension: Do 09 Mai | Pentecost: So 19 Mai | Trinity: So 26 Mai | Corpus: Do 30 Mai
2014 | Easter: So 20 Apr | Ascension: Do 29 Mai | Pentecost: So 08 Jun | Trinity: So 15 Jun | Corpus: Do 19 Jun
2015 | Easter: So 05 Apr | Ascension: Do 14 Mai | Pentecost: So 24 Mai | Trinity: So 31 Mai | Corpus: Do 04 Jun
2016 | Easter: So 27 Mrz | Ascension: Do 05 Mai | Pentecost: So 15 Mai | Trinity: So 22 Mai | Corpus: Do 26 Mai
2017 | Easter: So 16 Apr | Ascension: Do 25 Mai | Pentecost: So 04 Jun | Trinity: So 11 Jun | Corpus: Do 15 Jun
2018 | Easter: So 01 Apr | Ascension: Do 10 Mai | Pentecost: So 20 Mai | Trinity: So 27 Mai | Corpus: Do 31 Mai
2019 | Easter: So 21 Apr | Ascension: Do 30 Mai | Pentecost: So 09 Jun | Trinity: So 16 Jun | Corpus: Do 20 Jun
2020 | Easter: So 12 Apr | Ascension: Do 21 Mai | Pentecost: So 31 Mai | Trinity: So 07 Jun | Corpus: Do 11 Jun

Any idea why?

:?

dR nli
• Guests
• Last active:
• Joined: --
For all those interested on alternate easter calculation, feb/2008 i wrote a lil script which got published in german forum which calculates the most important christian german dates.

its located here: http://de.autohotkey...opic.php?t=2563 and may be easiliy adjusted toother dates aswell (as for easter it calculates only the easter sunday and all other dates in relation to that result). it also uses polyethene's dateparse function

n-l-i-d
• Guests
• Last active:
• Joined: --
Thanks, but that script also doesn't work with dates before 1700.

:?

• Members
• 399 posts
• Last active: Feb 26 2016 05:31 AM
• Joined: 25 Jan 2006

Got pointed to your posting through the mention in the RosettaCode thread by MasterFocus.

In preparation for the RosettaCode Holidays related to Easter task, I adapted your code, but found it doesn't work with dates below 1700 (?).

...

Any idea why?

:?

Not really - since I'm not the inventor of this algorithm.
The original algorithm dates from approx. 1580 and it's original inventor was Christophorus Clavius. Im 1582 the christian calendar was reformed with introducing the Gregorian calendar. The formula shouldn't work before 1582 therefore...
The algorithm was translated into an useable formula by C.F.Gauss (died 1855). I used a formula based on Gauss' formula ... perhaps he used a "future oriented" formula - not considering dates in the past... (In fact I didn't use original Gauss formula - but a "computer applicable" formula

n-l-i-d
• Guests
• Last active:
• Joined: --
Found it, it's an AutoHotkey thing...

only years between 1601 and 9999 are supported