Try this
<?php
$dteStart = new DateTime("16:00:00");
$dteEnd = new DateTime("20:00:00");
$dteDiff = $dteStart->diff($dteEnd);
print $dteDiff->format("%H:%I"); // if you want to print seconds then use this: "%H:%I:%S" in format function
?>
solved how to find the difference between 2 time formats using php [closed]