timedelta implemented using modules python datetime Date Time adding:
python calculate tomorrow's date:
from datetime import datetime
from datetime import timedelta
now = datetime.now()
aDay = timedelta(days=1)
now = now + aDay
print(now.strftime('%Y-%m-%d'))
python computing time yesterday:
from datetime import datetime
from datetime import timedelta
now = datetime.now()
aDay = timedelta(days=-1)
now = now + aDay
print(now.strftime('%Y-%m-%d'))
Use timedelta can easily do on a date day days, hours hour, minutes, seconds, milliseconds, subtle calculation of time, if you need another month to calculate approach
Last month, the calculation of the month
import time
last_month = time.localtime()[1]-1 or 12 #减去几就是上几个月
print(last_month)