python获取昨日日期

获取昨日日期
oneday = datetime.timedelta(days=1) 一天

day = datetime.datetime.strptime(self.date,'%Y-%m-%d')

day2 = day - oneday
或者
today = datetime.date.today()
yesterday = str(today - datetime.timedelta(days=1))
posted @ 2019-05-27 09:22  php、凯  阅读(3246)  评论(0编辑  收藏  举报