标签:port date str import strftime imp size span day
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2020, 5, 20, 23, 23, 31, 57908)
>>> cur_time = datetime.datetime.now()
>>> cur_time.strftime(‘%Y-%m-%d‘)
‘2020-05-20‘
>>> cur_time+datetime.timedelta(days=20)
datetime.datetime(2020, 6, 9, 23, 24, 16, 160627)
>>> future_time = cur_time+datetime.timedelta(days=20)
>>> future_time.strftime(‘%Y-%m-%d‘)
‘2020-06-09‘
标签:port date str import strftime imp size span day
原文地址:https://www.cnblogs.com/legalcode/p/12927268.html