Y
Hacker News
new
|
ask
|
show
|
jobs
by
yen223
842 days ago
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.
1 comments
LeoPanthera
842 days ago
relativedelta will do it:
from dateutil.relativedelta import relativedelta one_year = relativedelta(years=1)
link