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

F

Frank Millman

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
 
L

Larry Bates

Frank said:
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
I've always used

from mx.DateTime import DateTimeFromCOMDate
t=DateTimeFromCOMDate(dbidate)

Larry Bates
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,131
Latest member
IsiahLiebe
Top