1 import datetime 2 from pandas.tseries.offsets import Day 3 now_time =datetime.datetime.now()#获取当前时间 4 yes_time = (now_time -1*Day()).strftime('%Y-%m-%d')#格式化