With timedelta
it's possible to convert days ago
to exact date:
import datetime as DT
today = DT.date.today()
week_ago = today - DT.timedelta(days=1247)
print(week_ago)
2016-10-02
Is there a function which for given utc time does the opposite?
minutes ago if delta < hour,
hours ago if delta < day,
days ago if delta < week,
weeks ago if delta < month,
years ago if delta > year
It is spossible to do this with a bunch of if
s, but not every month is equal to 30 days.