# 计算间隔
#自定义时间
d1 = datetime.datetime.strptime('2012-03-05 17:41:20', '%Y-%m-%d %H:%M:%S')
print(d1)
day1 = datetime.datetime(2018,5,16,18,20,2)
day2 = datetime.datetime(2018,4,20,20,3,2)
print((day1-day2).days)
####
#当前时间
strTimeKey = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(strTimeKey)
#偏移时间
strTimeKey = (datetime.datetime.now()+datetime.timedelta(days=15,hours=2,minutes=1)).strftime("%Y-%m-%d %H:%M:%S")
print(strTimeKey)