You can get it in mysql using this.
SELECT TIMESTAMPDIFF(SECOND, column1, column2);
to get it in php see this answer
Getting time difference between two times in PHP
Or use something like the following where you would use the dates you got from mysql as the strings to DateTime.
1 <?php
2
3 $time1 = new DateTime('13:00:59');
4 $time2 = new DateTime('19:01:00');
5 $interval = $time1->diff($time2);
6 print_r($interval->format('%h:%s'));
To get the interval in a different format change the format string. You can find the valid string values in the DateTime documentation here
To get minutes use "%i" or "%l", the latter has leading zeros.
1 <?php
2
3 $time1 = new DateTime('13:00:59');
4 $time2 = new DateTime('19:01:00');
5 $interval = $time1->diff($time2);
6 print_r($interval->format('%l'));