Note, you can do: minus_5_min = 'DATETIME((writetime), "-5 minutes")' row = db(db.mytable).select(minus_5_min).first() print row[minus_5_min]
Anthony On Thursday, May 29, 2014 11:49:06 PM UTC-4, Pham Quang Dung wrote: > > Hm, > Not true, I forgot to say I did with execlsql OK, for Sqlite, > select DATETIME((writetime), "-5 minutes") from xxx > > On Friday, May 30, 2014 2:35:42 AM UTC+7, Niphlod wrote: >> >> This will never work because there is no notion of "timedelta" in any db >> backend (nor any substitute for it). >> Calculate the result AFTER fetching the rows from the db. >> >> On Thursday, May 29, 2014 12:32:41 PM UTC+2, Pham Quang Dung wrote: >>> >>> I tried a query like *db().select(xx.writetime - timedelta(minutes=5)) *and >>> the result was totally a surprise because it was of type "Int". Thoughts? >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.