Range of valid years for calendar module?

Tim Peters tim.peters at gmail.com
Mon Nov 15 17:34:24 CET 2004


[Jack Crane]
> Here's my calendar_for_specified_year.py.
>
> ==============================================
> # calendar_for_specified_year.py
> # print any year's calendar from 1753 A.D. through at least 3999 A.D.
> 
> import calendar
> 
> calendar.setfirstweekday(6) # sets first day of week to Sunday
> 
> year = int(raw_input("Year for which to print calendar: "))
> 
> print "\n\n"
> calendar.prcal(year)
> ===============================================
> 
> I've been trying to find out the range of years for which it will give me
> a valid calendar, and I've come up with "from 1753 to at least 3999".
...
> Does anyone know the actual range for the calendar module?

In modern Pythons, the usable range is inherited from the datetime
module:  years 1 through 9999.  This is the "proleptic Gregorian"
calendar, which means the current Gregorian calendar indefinitely
extended in both directions (past and future).  The idea that this
calendar came into universal use in 1753 is fiction -- for that
matter, so is the idea that this calendar is in univeral use today
<wink>.



More information about the Python-list mailing list