I'm using mktime to create a start and finish time.
I then subtract the start time from the finish time.
The interval as calculated is an hr short of the correct result.
Code: Select all
$start_dt = mktime($start_hr, $start_min, 0, $start_mth, $start_day, $start_yr);
echo date("F j, Y - g:i A", $start_dt); // outputs November 8, 2003 - 9:30 PM
$finish_dt = mktime($finish_hr, $finish_min, 0, $finish_mth, $finish_day, $finish_yr1);
echo date("F j, Y - g:i A", $finish_dt);// outputs November 9, 2003 - 2:45 AM
$interval = $finish_dt - $start_dt;
echo date("g:i", $interval); //outputs 4:15 and not 5:15 as requiredHow do I convert the result obtained from subtracting a start (mktime result) from a finish (mktime result) to a decimal.
For example if the interval result is 5:15, I wish to calculate the decimal equivalent as 5.25 (for use in an invoicing app).
Any assistance will be most appreciated.
- Andrew