On Sat, Jan 21, 2006 at 12:12:30PM -0800, Cliff Wells wrote:
> class Event ( SQLObject ):
> summary = StringCol ( )
> date = DateTimeCol ( )
> What's the right way to select the articles for a particular day?
> I can use
> events = Event.select ( AND ( Event.q.date > datetime ( year, month, day ),
> Event.q.date < datetime ( year, month, day + 1 ) ) )
> but I'm wondering if there's a more concise way.
I don't think there is.
Can I fix some bugs in the code? The first comparison should be ">=", I
datetime ( year, month, day + 1 ) will return wrong result or even raise
an exception if the day is the last day of the month. You'd better use
datetime arithmetic, timedelta, etc.
Oleg Broytmann http://phd.pp.ru/ phd@...
Programmers don't die, they just GOSUB without RETURN.