odbc DbiDate date conversion

flupke flupke at nonexistingdomain.com
Tue Sep 26 09:31:36 EDT 2006


I'm using a solid DB and i'm accessing it via the odbc module
(activepython).
I get a DbiDate object returned but i don't find a way to decently print
it or get a format like %d/%m%/%y.

I found a few posts but the code doesn't work.
>>> birthd = results[0][4] #info from db
>>> birthd
<DbiDate object at 0x0087E040>
>>> str(birthd)
'e\x00\x00d\x00\x00\x19d\x01\x00\x19Z\x01\x00d\x02\x00S\x00[4]\n\x00'
>>> t = time.strftime('%d %B %Y', birthd)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: argument must be 9-item sequence, not DbiDate

How can i convert this DbiDate to a string formated like '%d %B %Y'

I look at the DB API 2.0 but couldn't find the relevant info.

Thanks,
Benedict



More information about the Python-list mailing list