python 日期计算相关

引入:

from datetime import datetime,date,timedelta

 

最常见与YYYYMMDD格式字符串日期的相关计算

today:

today = datetime.now()

str_today = today.strftime('%Y%m%d')

nextday:

nextday = datetime.strptime(str_today,'%Y%m%d') + timedelta( days = 1)

str_nextday = nextday.strftime('%Y%m%d')

 

 

 

 

 

 

posted @ 2019-02-14 14:17  pguan  阅读(315)  评论(0编辑  收藏  举报