python 获取与当前系统相关时间的方法
import datetime
from dateutil.relativedelta import relativedelta
now_time = datetime.datetime.now()
this_day = str(now_time.strftime('%Y%m%d'))
last_5days = (now_time - relativedelta(days = 5)).strftime('%Y%m%d')
after_5days = (now_time + relativedelta(days = 5)).strftime('%Y%m%d')
this_ym = str(now_time.strftime('%Y%m') )
last_ym = (now_time - relativedelta(months = 1)).strftime('%Y%m')
start_ym = (now_time - relativedelta(months = 25)).strftime('%Y%m')
next_ym = (now_time + relativedelta(months = 1)).strftime('%Y%m')