获取当天日期--及本周五天的时间

tr_date = time.strftime("%Y%m%d", time.localtime())
print("tr_date======",tr_date)
today = datetime.date.today()
print("today======",today)
# 开始日期
start_date = today - datetime.timedelta(days=today.weekday())
print('datetime.timedelta(days=today.weekday())====',datetime.timedelta(days=today.weekday()))
print("start_date111111111111111111======",start_date)
start_date = start_date.strftime("%Y%m%d")
print("start_date======",start_date)
# 结束日期
end_date = today + datetime.timedelta(days=today.weekday())
print("end_date11111111111111111111======",end_date)
end_date = end_date.strftime("%Y%m%d")
print("end_date======",end_date)

 

posted @ 2019-12-18 11:57  Y-喵喵  阅读(228)  评论(0编辑  收藏  举报