import datetime
def _getYesterday():
today = datetime.date.today()
oneday = datetime.timedelta(days=1)
yesterday = today - oneday
return yesterday
today=_getYesterday()
print(today) # 今天是7月16 , 返回结果是 2018-07-15
import datetime
def _getYesterday():
today = datetime.date.today()
oneday = datetime.timedelta(days=1)
yesterday = today - oneday
return yesterday
today=_getYesterday()
print(today) # 今天是7月16 , 返回结果是 2018-07-15
本文标题:快速获取昨天的日期(time模块使用)
本文链接:https://www.haomeiwen.com/subject/czmbpftx.html
网友评论