request.now contains your current date and time, so you could do:

import datetime
delta=datetime.timedelta(hours=1)

rows=db(db.table.field <= request.now-delta).select()

You can also use:
delta=datetime.timedelta(minutes=30)
delta=datetime.timedelta(days=10)
delta=datetime.timedelta(weeks=3)
delta=datetime.timedelta(months=2)
etc.


On Apr 26, 8:24 pm, JoshC <[email protected]> wrote:
> Can anyone tell me how to take the date from a db field with type date
> and compare it with a system one? I need to be able to filter rows
> with dates in the last week, month, or year.

Reply via email to