[Tutor] SQL Datetimes

Bill Kranec billk at fastmail.fm
Tue Feb 15 05:02:58 CET 2005


Hello,

I'm using Kinterbasdb to access a Firebird database through Python, and 
when I retrieve a row with a datetime value, I get a tuple like:

 >>> myCursor.execute( 'SELECT * FROM table' )
 >>> for row in myCursor.fetchall():
        print row
   
(<DateTime object for '2004-08-09 00:00:00.00' at d41720>, 'value2', 
'value3', 'value4', 100)

I would like to get:

('8/9/2004', 'value2', 'value3', 'value4', 100)

The formatting of the date isn't so important, though.

Does anyone know how to convert the DateTime object into an actual 
datetime, and vice versa? I'm pretty sure what I want to do is 
documented here ( 
http://kinterbasdb.sourceforge.net/dist_docs/usage.html#adv_param_conv_dynamic_type_translation 
), but I don't understand what is going on.

Thanks for any help,

Bill


More information about the Tutor mailing list