DbiDate object

R

revuesbio

Hi all

I am using odbc to connect to Microsoft Access DB. When I send a
request with a datetime column from the database, odbc returns
something called a DbiDate object.
ex :
Fri Apr 20 07:27:45 2007

I would like to select columns where datetime ("DbiDate column") is >
yesterday date.
and i don't understand how to send request with this DbiDate.

Could you help me ?
thank you
 
F

Frank Millman

Hi all

I am using odbc to connect to Microsoft Access DB. When I send a
request with a datetime column from the database, odbc returns
something called a DbiDate object.
ex :>>> x=data[0][2]

<DbiDate object at 0x009C4140>>>> print x

Fri Apr 20 07:27:45 2007

I would like to select columns where datetime ("DbiDate column") is >
yesterday date.
and i don't understand how to send request with this DbiDate.

Could you help me ?
thank you

I also use the odbc module, but I store dates in my system as
datetime.datetime objects.

I convert a DbiDate object to a datetime object like this -

import datetime as dt
date = dt.datetime.fromtimestamp(int(dbidate))

For selects, I use the datetime object directly -

cur.execute('select * from table where date = ?',(date,))

I'm not sure how the odbc module handles that - maybe it converts date
into str(date). In any case, it just works for me.

HTH

Frank Millman
 
R

revuesbio

I am using odbc to connect to Microsoft Access DB. When I send a
request with a datetime column from the database, odbc returns
something called a DbiDate object.
ex :>>> x=data[0][2]
<DbiDate object at 0x009C4140>>>> print x
Fri Apr 20 07:27:45 2007
I would like to select columns where datetime ("DbiDate column") is >
yesterday date.
and i don't understand how to send request with this DbiDate.
Could you help me ?
thank you

I also use the odbc module, but I store dates in my system as
datetime.datetime objects.

I convert a DbiDate object to a datetime object like this -

import datetime as dt
date = dt.datetime.fromtimestamp(int(dbidate))

For selects, I use the datetime object directly -

cur.execute('select * from table where date = ?',(date,))

I'm not sure how the odbc module handles that - maybe it converts date
into str(date). In any case, it just works for me.

HTH

Frank Millman

it works !
thank you for your help ;-)
 

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

Staff online

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top