获取昨天日期

 

DAY = 24*60*60
today = time.strftime("%Y%m%d", time.localtime(time.time()))
today_data = get_day_data(today)
yestoday = time.strftime("%Y%m%d", time.localtime(time.time()-DAY))
yestoday_data = get_day_data(yestoday)

# 引入 datetime 模块
import datetime
def getYesterday(): 
    today=datetime.date.today() 
    oneday=datetime.timedelta(days=1) 
    yesterday=today-oneday  
    return yesterday
 
# 输出
print(getYesterday())

 

posted @ 2019-03-26 14:04  lvmenghui001  阅读(535)  评论(0编辑  收藏  举报