from datetime import datetime
import time
if __name__ == '__main__':
sdate = '2022-03-14'
edate = '2022-03-20'
sdate1 = time.strptime(sdate, "%Y-%m-%d")
edate2 = time.strptime(edate, "%Y-%m-%d")
sdate1 = datetime.datetime(sdate1[0], sdate1[1], sdate1[2])
edate2 = datetime.datetime(edate2[0], edate2[1], edate2[2])
xg_day = (edate2-sdate1) + datetime.timedelta(days=1) # 需要加一天
sdate_huanbi = sdate1 - datetime.timedelta(days=xg_day.days) # 加xg_day天
edate_huanbi = edate2 - datetime.timedelta(days=xg_day.days) # 加xg_day天