Hello
How do I solve this query?
db.define_table('my_table',
SQLField('start_date', 'date'),
SQLField('ndays', 'integer'),
...
)
def my_function():
import datetime
current_date = datetime.date.today()
#Option 1
query=(db.my_table.start_date + db.my_table.ndays >= current_date)
#Option 2
query=(db.my_table.start_date + datetime.timedelta(days=30) >=
current_date)
#Option 3
query=(db.my_table.start_date + datetime.timedelta
(days=db.my_table.ndays) >= current_date)
rows = db(query).select()
return dict(rows=rows)
Always ignores the added to the date. The option 3 obviously produces
a mistake.
Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---