Difference between revisions of "Python - DbiDate"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) |
PeterHarding (talk | contribs) |
||
Line 20: | Line 20: | ||
<pre> | <pre> | ||
cur.execute('select * from table where date = ?',(dt,)) | |||
</pre> | </pre> | ||
Revision as of 13:38, 28 May 2008
References
Notes
Conversion
Accessing a SqlServer dataabse via the ActiveState Python ODBC implementation returns dates as a DbiDate object.
To convert them into a datetime formate where they are more easily manipulated do the following:
dt = datetime.datetime.fromtimestamp(int(dbidate))
DbiDate Use in SELECT
For selects, use the datetime object directly -
cur.execute('select * from table where date = ?',(dt,))