Answers for "python timedelta in years"

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
3

datetime.timedelta months

from datetime import timedelta
from dateutil.relativedelta import relativedelta

end_date = start_date + relativedelta(months=delta_period) + timedelta(days=-delta_period)
Posted by: Guest on June-30-2020

Python Answers by Framework

Browse Popular Code Answers by Language