472,143 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

DbiDate object

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

May 28 '07 #1
2 1982
On May 29, 12:51 am, revuesbio <revues...@gmail.comwrote:
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

May 29 '07 #2
On 29 mai, 07:22, Frank Millman <f...@chagford.comwrote:
On May 29, 12:51 am, revuesbio <revues...@gmail.comwrote:
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
it works !
thank you for your help ;-)

May 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by lawrence | last post: by
1 post views Thread by Frank Millman | last post: by
1 post views Thread by Bijay Kumar | last post: by
reply views Thread by Bijay Kumar | last post: by
26 posts views Thread by yb | last post: by
7 posts views Thread by flupke | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.