You can do a program such as this:
import datetime
time_1 = datetime.datetime(2018, 5, 5, 12, 5, 1)
time_2 = datetime.datetime(2018, 5, 5, 14, 5, 1)
new_time = time_2 - time_1
seconds = new_time.total_seconds()
time = seconds / 60
print(int(time))
The time difference is two hours just, similar to what you’re asking for. A timedelta object in python 2.7 or higher has a total seconds method. So after subtracting the two times you are left with a timedelta object. You can perform the total_seconds() method on it, and then divide by 60 obviously to get minutes. You can then print that result, and you will find the total minutes between two times:
120
solved Find time duration between two time format in python? [closed]