from datetime import datetime t1=input("Start time\n") t2=input("End time\n") fmt='%H:%M:%S' t=str(datetime.strptime(t2,fmt)-datetime.strptime(t1,fmt)) h,m,s=map(int,t.split(':')) print("Time in milliseconds is {}".format(int(3600000*h+60000*m+1000*s)))