Intelligent strptime?

Ian Clarke I.Clarke at
Thu Nov 11 07:01:26 EST 1999

> Does there exist an intelligent strptime? "26/11/99", for example, can _only_
> mean the 26th November of this year, and the chance that "14:11:12" means
> 14 november 1912 is very small. Is there a module/function that guesses the
> format? There isn't doubt very often, only for 12/11/99, US is 11 december,
> Europe is 12 November (isn't it?).

While I don't know what the application is, if you are processing user
input I strongly recommend against doing this.  In a project I am
working on the issue of whether to provide a "best guess" as to a date
came up, but we decided that it was much better if a date had been
entered incorrectly to furnish the user with an error, than attempt to
correct that error automatically.  Sure in the short term it makes life
a little easier for the user, but it also allows them to get used to the
computer correcting their errors, and when the time comes that the
computer cannot correct their error, or makes an incorrect guess, they
will feel that there is something wrong ("I have always entered dates in
MMDDYY format and it worked fine, why shouldn't it work now?").


Ian Clarke                        Email: I.Clarke at
Also see:
"All we see and all we seem is but a dream within a dream"

More information about the Python-list mailing list