import time # t = time.time() # print(t) # z = time.strftime('%Y-%m-%d %H:%M:%S') # print(z) # # a = time.localtime(time.time()) # print(a) nowtime = time.time() longtime = time.strptime('2018-10-17 6:0:0','%Y-%m-%d %H:%M:%S') print(longtime) d = time.mktime(longtime) print(d) new = nowtime - d print(new) s = time.localtime(new) ss = time.strftime('%H:%M:%S',time.localtime(new)) print(ss)