Get amount of hours between 2 hours

If you would like to get the amount of hours between 10:00 and 12:00 then use this!

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

echo (timeDiff("10:00","12:00")/60)/60;
Tags:
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments