Generate the YYYY-MM-DD Format Date
作者:XD / 发表: 2023年6月5日 07:44 / 更新: 2023年6月5日 07:44 / 编程笔记 / 阅读量:603
Generate the YYYY-MM-DD format date from a start date to an end date.
from datetime import date, timedelta
start_date = date(2023, 5, 16)
end_date = date(2023, 6, 5)
delta = timedelta(days=1) # This represents a difference of 1 day
current_date = start_date
while current_date <= end_date:
print(current_date)
current_date += delta