timedelta object
from datetime import datetime, timedelta
dateFormat = '%Y-%m-%d'
startDate = datetime.strptime('2020-11-20', dateFormat)
endDate = datetime.strptime('2020-11-30', dateFormat)
diff = endDate - startDate
dates = []
for i in range(diff.days + 1):
date = startDate + timedelta(days=i)
dates.append(date.strftime(dateFormat))
print(dates)
Leave a Comment
Cancel reply