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

Robert Brewer fumanchu at amor.org
Thu Mar 17 19:17:00 CET 2005


Frank Millman wrote:
> 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.

Try:

datetime.datetime.utcfromtimestamp(int(value))

I gave up on dbiDates completely, however, (since their range is so
limited) and use strings instead.


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org

No virus found in this outgoing message, because:
1) it's plain text, and 
2) doesn't have an attachment.
Checked by Common-Sense Anti-Virus, Version: 0.0.001



More information about the Python-list mailing list