[Python-Dev] dateutil
Christian Tanzer
tanzer at swing.co.at
Fri Mar 12 11:10:09 EST 2004
"Brett C." <bac at OCF.Berkeley.EDU> wrote:
> > * Computing of Easter Sunday dates for any given year,
> > using Western, Orthodox or Julian algorithms;
> >
>
> Don't really see the use in this other than the rule figuring this out
> is odd enough that I never remember. Who really cares when Easter is
> beyond certain religious groups?
Anybody living in a part of the world with some public holidays based
on Easter. For instance, in Austria there are five of these.
BTW, I can't really see why you have such a hard time remembering:
if 1583 <= year <= 1699 : m, n = 22, 2
elif 1700 <= year <= 1799 : m, n = 23, 3
elif 1800 <= year <= 1899 : m, n = 23, 4
elif 1900 <= year <= 2099 : m, n = 24, 5
elif 2100 <= year <= 2199 : m, n = 24, 6
elif 2200 <= year <= 2299 : m, n = 25, 0
else :
raise NotImplementedError, \
"Only implemented for years between 1583 and 2299"
a = year % 19
b = year % 4
c = year % 7
d = (19*a + m) % 30
e = (2*b + 4*c + 6*d + n) % 7
day = 22 + d + e
if day <= 31 :
month = 3
else :
day = d + e - 9
month = 4
if day in (25, 26) and d == 28 and e == 6 and a > 10 :
day -= 7
return (year, month, day)
<42.0 wink>
Cheers,
--
Christian Tanzer http://www.c-tanzer.at/
More information about the Python-Dev
mailing list