I was wondering how can I calculate the time difference between two times which have PM and AM next to them for example. I have 12:16:44 pm and 01:01:45 pm but when I use this code:
from datetime import datetime
from datetime import timedelta
s1=12:16:44
s2=01:01:45
FMT = '%H:%M:%S'
tdelta = datetime.strptime(s2), FMT) - datetime.strptime(s1), FMT)
if tdelta.days < 0:
tdelta = timedelta(days=0,
seconds=tdelta.seconds,
microseconds=tdelta.microseconds)
but this is the output I get
12:16:44 | 01:01:45 | Time Difference: -1 day, 12:45:01
but they are both PM values? Thanks