Answers for "python datetime timedelta one year"

1

timedelta year python

import datetime
from dateutil.relativedelta import relativedelta

last_year = (datetime.datetime.now()-relativedelta(years=1)).strftime("%Y-%m-%d")
Posted by: Guest on June-22-2021

Python Answers by Framework

Browse Popular Code Answers by Language