Right now we are taking multiple times and getting their disparities, the following code can be utilized to get specific time distinction between multiple times.
Source Code and Output to get time distinction:
<?php
$time1="09:00";
$time2="17:00";
function get_time_difference($time1, $time2)
{
$time1 = strtotime($time1);
$time2 = strtotime($time2);
if ($time2 < $time1)
{
$time2 += 86400;
}
return date("H:i", strtotime("00:00") + ($time2 - $time1));
}
$timediff= get_time_difference($time1, $time2); // 12:15:29
printf("Difference between in time : " .$timediff);
print "</br>";
?>
Output:
Difference between in time : 08:00