Answers for "python get last datetime for a day"

1

get last year of today 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
2

python datetime last day of month

>>import calendar
>>year, month = 2016, 12
>>calendar.monthrange(year, month)[1]
31
Posted by: Guest on February-08-2021

Code answers related to "python get last datetime for a day"

Python Answers by Framework

Browse Popular Code Answers by Language