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

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)

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

上一篇:用 Python 编写一个天气查询应用 pyqt5


下一篇:PHP获取本月时间