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

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

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