It’s very simple to get the difference in hours using PHP

function timeDiff($firstTime,$lastTime) {
 $firstTime=strtotime($firstTime);
 $lastTime=strtotime($lastTime);
 $timeDiff=$lastTime-$firstTime;
 return $timeDiff;
}

echo (timeDiff("10:00","12:00")/60)/60;
Categories:ContentGeneral

Leave a Reply

Your email address will not be published.

%d bloggers like this: