import time
import datetime
now = ‘2020-05-31’
date= ‘2020-05-18’
date1=time.strptime(date,"%Y-%m-%d")
date2=time.strptime(now,"%Y-%m-%d")
date1=datetime.datetime(date1[0],date1[1],date1[2])
date2=datetime.datetime(date2[0],date2[1],date2[2])
time1=date2-date1
type(time1.days)
print(time1.days)
取YYYY-MM-DD的日期差
最新推荐文章于 2023-08-16 16:01:54 发布