I set up my MySQL database with the field \'time\'
It is not HH:MM in the traditional sense, it is the time an event occurred, so an event with the value of 5:45 occ
Just use
TIMEDIFF(fromtime, totime):
SELECT TIMEDIFF("12:25", "5:45");
If you need a decimal, use TIME_TO_SEC()/3600
(it assumes you passed it seconds, but the format you're storing the times in is vague and SQL probably will interpret them as HH:MM - you can fix this with CONCAT("00:",MinuteSecondField)
maybe?) - then you can use TIME_TO_SEC()/60
, which is more correct)