python自动化测试——年月日加减天数

import datetime

today = datetime.date.today()
print(today)  #2019-02-25

#加一天
tomorrow = today + datetime.timedelta(1)
print(tomorrow) #2019-02-26

#減一天
yesterday = today + datetime.timedelta(-1)
print(yesterday) #2019-02-24

#減3天
date = today + datetime.timedelta(-3)
print(date) #2019-02-22

 

posted @ 2019-02-25 17:19  OTAKU_nicole  阅读(647)  评论(0编辑  收藏  举报