ADOdbapi converting all data to strings

Robert Brewer fumanchu at
Mon Aug 16 08:17:56 CEST 2004

max wrote:
> I am trying to access a foxpro database, using odbc all is well except
> that dates prior to 1970 are not returned as valid usable data, so
> would like to use ADO. When I select data containing numbers (long or
> float) they are converted and returned as unicode strings. Dates are
> returned as which is great. Is there any way to change
> this behavior other than to explicitly change back all fields using
> cursor.description information.

I *think* you're saying that you have a COM date (which is similar to a
float), and want a

import datetime
# 12/30/1899, the zero-Date for ADO = 693594
zeroDate =, 12, 30).toordinal()

def coerce_datetime(value):
    return + zeroDate)

COM times are more complicated. Inquire further if you need to handle

Robert Brewer
Amor Ministries
fumamchu at

More information about the Python-list mailing list