4 ms·
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 sen
by yen223 3y 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.
- LeoPanthera 3y agorelativedelta will do it: from dateutil.relativedelta import relativedelta one_year = relativedelta(years=1)