Find time until a date in Python -
What is the best way to find up to date? I want to know the years, months, days and hours
< P> I was hoping someone had a good job. I want to do something like this: This comment was posted 2 months ago and three days ago or this comment was posted 1 year ago 5 months ago.
you must .relativedelta.
should use from dateutil.relativedelta import relativedelta import datetime today = datetime.date.today () rd = relativedelta (Today, datetime.date (2001,1, 1)) Print "Comment % (Years) D years,% (months) D month,% (days) days ago "% rd .__ dict__
Comments
Post a Comment