How to calculate hours, minutes or seconds between two time values?
If you have time values, just subtract them, and you'll get the interval length in seconds:
select end_time - start_time
If you want to get minutes, divide the result by 60, and if you want hours by 3600.
If you have timestamps instead of times, the difference is in days, so you if you want seconds, you need to multiply the value by 60 * 60 * 24.