Error : strptime() argument 1 must be str, not int
I am trying to substract two times and getting an error. In below total error is coming up
if result[0]['outTime'] != None:
type = "bothPunchDone"
FMT = '%H:%M:%S'
total= datetime.strptime(result[0]['outTime'], FMT) - datetime.strptime(result[0]['inTime'], FMT)
I tried but not able to solve the issue.
from datetime import datetime
result = datetime.now().strftime("%H:%M:%S")
if result != None:
type = "bothPunchDone"
FMT = '%H:%M:%S'
total= datetime.strptime(result, FMT) - datetime.strptime(result, FMT)
print(total)
is working for me. Try to check the type of result[0]['outTime']