I am using 2 timestamp in my table which is starttime datatype- timestamp and as current timestamp. endtime datatype-timestamp and default as 0000-00-00 00:00:00
ho
try this code, tested on phpfiddle.org :-
function timestampdiff($qw,$saw) { $datetime1 = new DateTime("@$qw"); $datetime2 = new DateTime("@$saw"); $interval = $datetime1->diff($datetime2); return $interval->format('%Hh %Im'); } echo timestampdiff('1524794340', '1524803100');