Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

timedelta doesn't take "years" as a parameter, for the reasons others have listed here. It's ambiguous what subtracting by a year means, and there's no real sensible default either.


relativedelta will do it:

  from dateutil.relativedelta import relativedelta
  one_year = relativedelta(years=1)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: