Time objects and ADO

dsavitsk dsavitsk at e-coli.net
Sun May 6 06:10:43 CEST 2001


"John" <notehead2 at hotmail.com> wrote in message
news:LX2J6.43$6N5.13988 at newsread2.prod.itd.earthlink.net...
> 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
>

the Fields object has a type method (is that what you call it?).  you can
query it using

>>> type = rs.Fields.Item(j).Type

it should return an integer value.  i don't know the actual constants, but
Text is 202.  probably play with them for a while and you can figure them
out.

doug





More information about the Python-list mailing list