I want to compare two times which is in 12hrs format, but before comparing I have converted into strtotime and passed converted values to function and comparing it but output return 0 even there is time difference of 60 minutes still getting 0 in output.
<?php
function timediff($start, $end)
{
if($end >= $start) {
return (round(($end-$start)/3600, 0))." Hrs ".((($end-$start)%3600)/60)." Min"; // time should be in queue
} else {
return (round(($start-$end)/3600, 0))." Hrs ".((($start-$end)%3600)/60)." Min";
}
}
echo timediff(strtotime('09: am'), strtotime('08: am'));