[Tutor] datetime.date objects from SQL query?
Jan Eden
lists at janeden.org
Thu Sep 1 13:33:19 CEST 2005
Hi,
I use the following query (simplified):
self.dbh.execute("SELECT anreise, abreise FROM buchungen WHERE ferienhaus = '%(ferienhaus)s'" % { 'ferienhaus': ferienhaus} )
Both anreise and abreise are date fields. I initially wrote a little function to turn ISO formatted date strings into a datetime.date object
def StringToDate(datestring):
year, month, day = datestring.split('-')
datum = datetime.date(int(year), int(month), int(day))
return datum
But it looks as if the value of both anreise and abreise is returned as datetime.date objects automatically! This is great - but how does this happen?
Thanks,
Jan
--
Life's unfair - but root password helps!
More information about the Tutor
mailing list