[Tutor] Dates
Alan Gauld
alan.gauld at btinternet.com
Sun Sep 10 01:15:44 CEST 2006
John,
> c.execute('SELECT * FROM times where rt_weekst >= date(2006,01,31)
> and
> rt_weekst <= date(2006,12,31) and rt_type == ?', ("R",))
> a = datetime.date(2006,01,31)
> b = datetime.date(2006,12,31)
> c.execute('SELECT * FROM times where rt_weekst >= ? and rt_weekst <=
> ?
> and rt_type == ?', (a,b,"R",))
In the first case the dates are strings passed to the SQL date
function.
In the second they are Python datetime objects. I suspect you need to
convert the datetime objects to strings before passing them as
arguments
to execute()
Alan G
More information about the Tutor
mailing list