This article example describes a simple implementation of python to calculate the expiration time. Shared for your reference. Specific as follows:
def time_passed(value): now = () past = now - value if : return u'%s days ago' % mins = / 60 if mins < 60: return u'%s minutes ago' % mins hours = mins / 60 return u'%s hours ago' % hours
I hope that what I have described in this article will help you in your Python programming.