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

Popular posts from this blog

MySql variables and php -

c# - How can I find out if there are windows above a control? -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -