I am not sure I worded that correctly but python and time always confuses me. This is what I am trying. Given a unix timestamp (INT) which is definitely in the past (can be seconds ago or years ago) I want to generate a babel format_timedelta
My problem is
I can't figure out the part 2 and I believe there must be an easier/correct way to do this. Please share the best possible way to do this, also I need it to be fast in calculating since I have to use it in a web page.
def format_starttime(value, granularity="day"):
delta = datetime.timedelta(seconds=time.time() - value)
return format_timedelta(delta, granularity)
gives error in date.format_timedelta() AttributeError: 'module' object has no attribute 'format_timedelta'
import datetime
td = datetime.timedelta(seconds=time.time()-a_unix_timestamp)