mongodb数据库存入最近一周星期天凌晨时间

import datetime
today = datetime.datetime.now()
now_time=datetime.datetime(today.year, today.month, today.day, 0, 0, 0)
week_time = now_time.weekday()
future_time = now_time-datetime.timedelta(days=week_time+1)
d1= future_time.strftime('%Y%m%d')
weekend1= datetime.datetime.strptime(d1,'%Y%m%d')
weekend=weekend1+datetime.timedelta(hours=-8)
posted @ 2022-08-19 22:58  luoganttcc  阅读(0)  评论(0编辑  收藏  举报