OverflowError: mktime argument out of range ???

Diez B. Roggisch deets at nospam.web.de
Sun Apr 15 06:47:58 EDT 2007


Jorgen Bodde schrieb:
> Hi  List
> 
> I am working on an app to store guitar songs I am practicing, and for
> the fun of it I want to store the date of songs when they were
> originally made. So far so good..
> 
> However, my taste of music is "Rag Time Blues" and that os OLD, very
> OLD music. So it happened I entered a song from the date " 28 dec
> 1928".
> 
> It appears time.mktime cannot handle these 'extremities' ? I get an
> overflow error. is there by any chance a solution to this? I do know
> modern languages support at least 1900 as date (and now that I come to
> think of it, songs from J.S. Bach are excluded from entering as well)
> ..
> 
> This is what I try:
> 
>>>> time.mktime((1928, 12,28, 0, 0, 0,  0, 0, 0))
> Traceback (most recent call last):
>  File "<interactive input>", line 1, in <module>
> OverflowError: mktime argument out of range
> 
> The only solution I can think of is making a custom time class that
> handles all years, dates and months, but that is plain silly. I want
> to be able to use the long date formatting etc, and that would mean
> rewriting that part as well.

import datetime
datetime.date(1928, 12, 28)

Diez



More information about the Python-list mailing list