I have two different time in a 24-hr format which is time in and timeout. Given the scenario below:
$timeIn = "19:00";
$timeOut = "09:00";
//calculated it using strtotime
$timeDiff = strtotime($timeIn) - strtotime($timeOut);
$timeDiff = ($timeDiff/60)/60;
//result is 10:00
With this one, instead of returning 14hrs, it returns 10hrs only. How can I catch this one out?
UPDATE
Thanks for the comments guys. Here is how I do it:
if($timeIn > $timeOut){
$timeDiff = 24 - abs(strtotime($timeIn)/60)/60;
$timeDiff += $timeOut;
}else{
$timeDiff = strtotime($timeIn) - strtotime($timeOut);
$timeDiff = ($timeDiff/60)/60;
}