I'm having an attack of The Stupids. This should be simple but I'm borking it up somewhere.
I have two dates and I'm trying to find the minutes between the dates, but only within a given month. Take these two dates:
2010-12-27 14:05:00 (Dec 27 @ 2:05 pm)
2011-01-03 17:40:00 (Jan 3 @ 5:40 pm)
I only want the time that's in January, so I clip off days before the start of the month for the first date and turn it into "2011-01-01 00:00:00"...and this is where I think I'm going wrong.
Manually counting the time for "2011-01-01 00:00:00" to "2011-01-03 17:40:00" should be 48 hours for the first two days, plus 17 hours and 40 minutes for the partial 3rd day, or 65 hours and 40 minutes, right?
48 + 17 = 65 hours, plus 40 minutes.
The problem is all of the code I've tried reports 66 hours and 40 minutes, like this function:
Highlight Mode: (PHP)
function dateDiff($start, $end) {
$diff = round(abs($end_time - $start_time) / 60, 2); return $diff;
}
Several other functions give the same results: 66 hours and 40 minutes. Where oh where am I going wrong??