Hi, On Wed, Sep 29, 2010 at 11:42 AM, Peter Otten <__pete...@web.de> wrote:
> Carter Danforth wrote: > > > Thanks for the replies, Dave and Joel. The reason I'm not just using the > > time or datetime modules for a random date is because it's restricted to > > 1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer > > The datetime module is not restricted to 1970...2038. It allows years > 1...9999 (it uses the Gregorian calendar even before its adoption). > > >>> import datetime > >>> datetime.MINYEAR, datetime.MAXYEAR > (1, 9999) > >>> datetime.date(1500, 2, 29) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ValueError: day is out of range for month > >>> datetime.date(1600, 2, 29) > datetime.date(1600, 2, 29) > > Just an attempt from my side: The year 1500 didn't have a 29th of February, the 28th work for me but 29th also fails here. >>> datetime.date( 1500, 2, 28 ) datetime.date(1500, 2, 28) >>> datetime.date( 1500, 2, 29 ) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: day is out of range for month HTH Ewald
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor