How to create datetime object from DbiDate (win32.odbc)?

Frank Millman frank at chagford.com
Thu Mar 17 09:51:23 EST 2005


Hi all

I am using odbc from win32 extensions to connect to MS SQL Server. I
use mx.DateTime to handle dates. When I select a datetime column from
the database, odbc returns something called a DbiDate object. I cannot
find out any information on this type, but mx can convert it to a
mx.DateTime object using DateTimeFrom(), which is really all that I
need.

I am looking into changing from mx.DateTime to using the builtin
datetime type, but I cannot figure out how to convert a DbiDate object
to a datetime object.

First prize would be to have a datetime constructor that takes a
DbiDate object as input, in the same way that mx does, but this does
not seem to exist.

Second prize would be to extract the year/month/day elements from the
DbiDate object, and construct the datetime object manually. However, if
I try dir(d), where d is a DbiDate object, I get an empty list, so I
cannot even see how to extract the elements.

Does anyone know if this is possible, and if so, how?

Many thanks

Frank Millman




More information about the Python-list mailing list