Check for valid date

Remi Delon rdelon at my-deja.com
Mon Jun 21 18:44:20 CEST 1999


Hi, I'm trying to use the time module to check whether a date is
actually a valid day or not.
Unfortunately, it looks like the strptime function only performs a basic
range check. (for example, it will accept 02/30/199)
Here is a little test I did:

>>> strptime('02/30/1999','%m/%d/%Y)
(1999, 2, 30, 0, 0, 0, 61, 0)
>>> mktime((1999, 2, 30, 0, 0, 0, 61, 0))
920361600.0
>>> ctime(920361600.0)
'Tue Mar  2 00:00:00 1999'

Is there a way to check test whether the day actually exists or not ?


I also have a totally different problem : I'm trying to get python 1.5.2
to run with Tcl/Tk 8.1. Has anyone been able to do that on AIX ?
I found 2 patches for tkinter that were supposed to fix the problems,
but unfortunately, they don't work for AIX.

Thanks

Remi.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list