timedelta

from datetime import datetime, timedelta


def getBetweenDay(begin_date, end_date):
date_list = []
begin_date = datetime.strptime(begin_date, "%Y-%m-%d")
end_date = datetime.strptime(end_date, ('%Y-%m-%d'))

sql2 = "select count(1) from icsys.ft_be_chip_override_t where hive_partition_content="
sql_insert_raw_date = ''''''
while begin_date <= end_date:
date_str = begin_date.strftime("%Y-%m-%d")
date_list.append(date_str)
sql2_query = sql2 + '\'' + date_str + '\''
print(" %s" % sql2_query)
begin_date += timedelta(days=1)
return date_list


getBetweenDay('2020-06-18', '2021-01-01')

posted @ 2021-09-01 23:06  oceaning  阅读(109)  评论(0编辑  收藏  举报