当然 需要引入 datetime
import datetime
获取当前日期:datetime.datetime.now().strftime('%Y-%m-%d')
获取当前日期前七天日期:
now_time = datetime.datetime.now()
yes_time = now_time + datetime.timedelta(days=-7)
yes_time_nyr = yes_time.strftime('%Y-%m-%d')
当然 需要引入 datetime
import datetime
获取当前日期:datetime.datetime.now().strftime('%Y-%m-%d')
获取当前日期前七天日期:
now_time = datetime.datetime.now()
yes_time = now_time + datetime.timedelta(days=-7)
yes_time_nyr = yes_time.strftime('%Y-%m-%d')