Time objects and ADO
John
notehead2 at hotmail.com
Sat May 5 22:48:11 EDT 2001
Okay, I'm part of the way there. I located the mx extensions from Marc
Lemburg ( http://www.lemburg.com/files/python/ )that handle COM dates.
Here is what I am doing now. All this works the way I want it to
functionality-wise, but the type check part is a hack:
item = recordset.Fields.Item(j).Value
# There has to be a better way to tell the type
# of the time object than this!!!
# Seems like this should be the way to do it, but it doesn't work...
# if type(item) is DateTimeType:
if str(type(item)) == "<type 'time'>":
# Use the string representation of the time
item = str(DateTimeFromCOMDate(item))
Any help on figuring out how to do the type check would be much appreciated.
-John
"John" <notehead2 at hotmail.com> wrote in message
news:CG1J6.231$Hw5.25353 at newsread2.prod.itd.earthlink.net...
> Hi,
>
> I'm reading in records from an ADO recordset and putting each field in a
> Python list.
>
> When I print out the list, the datetime fields from the ADO recordset
print
> out like this... <time object at 01127730>
>
> I need to be able to do two things:
> 1. Check to see if the ADO field is a time object
> 2. Convert the time object into a human readable string and put that
in
> the list instead of the object itself
>
> I've searched all over the help files. I thought when I came onto the
PyTime
> object that I was onto something, but it seems that was a blind alley.
>
> Please help! :-)
>
> -John
>
>
>
More information about the Python-list
mailing list