Thanks Anthony. It almost works (but it fails in an odd way). I was getting 
some odd results, and I've narrowed it down to this:

In [10]: task_duration = (db.t_periods.f_end - db.t_periods.f_start) 
 
In [11]: results = db(query).select(p.id, p.f_start, p.f_end, task_duration
).as_list() 
 
In [12]: results 
Out[12]:  
[{'_extra': {'(t_periods.f_end - t_periods.f_start)': 118.0}, 
  't_periods': {'f_end': datetime.datetime(2018, 1, 8, 13, 59, 21), 
   'f_start': datetime.datetime(2018, 1, 8, 13, 58, 3), 
   'id': 37278L}}]


That shows a task_duration of 118.0, whereas actually it's 1:18.

The datatypes appear correct:

In [16]: p.f_start.type 
Out[16]: 'datetime' 
 
In [17]: p.f_end.type 
Out[17]: 'datetime'

I'm not sure why datetime - datetime is given a float answer. 

Keith

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to