Using this code: Calculate number of hours between 2 dates in PHP I want to calculate the number of hours between 2 timestamps.
What I need now is to be able to exclude weekend hours from this count?
e.g. For the following 2 time stamps, I’d expect the number of Hours to be 24 instead of 72.
$datetime1 = "2012-07-20 12:00:00";
$datetime2 = "2012-07-23 12:00:00";
The code below should work. I’m assuming $datetime1 is always less than $datetime2.