On Apr 6, 1:48 pm, [EMAIL PROTECTED] wrote:
(snipped)
> If I look in the MS Access database, I see the timestamp as "5/6/112".
> Obviously some user didn't enter the correct date and the programmer
> before me didn't give Access strict enough rules to block bad dates.
> How do I test for a malformed date object so I can avoid this? There
> are thousands of records to transfer.
>
time.strptime ?
import time
for date in ("5/6/2008", "5/6/118"):
try:
struct_tm = time.strptime(date, "%m/%d/%Y")
print "Good date: " + date
print struct_tm
except ValueError:
print "Bad date: " + date
--
Hope this helps,
Steven
--
http://mail.python.org/mailman/listinfo/python-list