Doh, you're right. All the "datetime" api on fields are extracting, not converting the actual value.... At this point you can sum up years difference, month difference, etc etc etc separately and then extract the time passed by. ..... duration_ye = (db.periods.end_time.year() - db.periods.start_time.year()).sum() duration_mo = (db.periods.end_time.month() - db.periods.start_time.month()).sum() duration_da = (db.periods.end_time.day() - db.periods.start_time.day()).sum() .....
This will be a "itchy" shot anyway.... even if you know that the months difference is "1" you can't really say how many days passed.... Maybe at this stage is better to save unix time, that is an integer, and proceed simply with duration = (db.periods.end_time - db.periods.start_time).sum() Or, having the application filling in the seconds elapsed when it completes.... something like period_to_update = db(db.periods.id==1).select().first() start_time = period_to_update.start_time period_to_update.update_record(end_time=request.now, seconds_elapsed=(request.now - start_time).seconds) Sorry for the wrong previous advices, really, I should have tested with all kinds of values (instead of 2012-01-01 00:00:00 and 2012-01-01 00:00:15).