i have 3 character type columns in my table has time format values i.e
while processing (in python 3.7) to in if condition i am using following statement;
t1 = '09:12'
t2 = '09:10'
t3 = '20:00'
if datetime.strptime(t1, '%H:%M') > datetime.strptime(t2, '%H:%M'):
print((datetime.strptime(t1, '%H:%M') - datetime.strptime(t2, '%H:%M')))
# above prints 00:02 but i need it to be 00:12 but below statement raise error
print((datetime.strptime(t1, '%H:%M') - datetime.strptime(t2, '%H:%M'))) + datetime.strptime(t2, '%M')
i need to ask
a) am i doing right thing to get compare above time values (string to date) or i have to compare it with strings values
b) i require difference of above subtract value with 00:12, please assist.
question from:
https://stackoverflow.com/questions/65679863/how-to-get-compare-time-values-and-difference-in-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…