[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Kalender mit Feiertagen?



On Thu, 19 Dec 2002, Andreas Tille wrote:

> ----------------------- >8 ----------------------------------------------
> #!/usr/bin/python
>
> from sys import argv
> from mx.DateTime import *
>
> def DateFormat(string, date):
>     print string + ": " + str(date.day) + '.' + str(ostern.month) + '.' + str(ostern.year)
s/ostern/date/g
>
> if len(argv) <= 1 :
>     year = now().year
> else:
>     year = int(argv[1])
>
> d=(((255 - 11 * (year % 19)) - 21) % 30) + 21
> if d > 48:
>     d+=1
>
> delta = d + 6 -  ((year + (year - ((year % 4))) / 4) + d + 1) % 7
>
> ostern = DateTime(year,3,1) + delta
>
> DateFormat("Karfreitag", ostern - 2)
> DateFormat("Ostern", ostern)
> DateFormat("Ostermontag", ostern + 1)
> DateFormat("Himmelfahrt", ostern + 39)
> DateFormat("Pfingstsonntag", ostern + 49)
> DateFormat("Pfingstmontag", ostern + 50)
>
> ----------------------- 8< ----------------------------------------------

... oder aber noch schöner ...

#!/usr/bin/python
from sys import argv
from mx.DateTime import *
from mx.DateTime.Feasts import *

def DateFormat(string, date):
    print string + ": " + str(date.day) + '.' + str(date.month) + '.' + str(date.year)

if len(argv) <= 1 :
    year = now().year
else:
    year = int(argv[1])

DateFormat("Rosenmontag", Rosenmontag(year))
DateFormat("Karfreitag", Karfreitag(year))
DateFormat("Ostern", Ostersonntag(year))
DateFormat("Ostermontag", Ostermontag(year))
DateFormat("Himmelfahrt", Himmelfahrt(year))
DateFormat("Pfingstsonntag", Pfingstsonntag(year))
DateFormat("Pfingstmontag", Pfingstmontag(year))
DateFormat("Fronleichnam", Fronleichnam(year))




Reply to: