Simple timesheet calculation

How do you calculate the number of hours (including minutes) that have elapsed between a $StartDate and $EndDate? I tried interval () but that dropped the minutes and only gives me whole hours. I need the total elapsed minutes that I can convert into hours or something like 7.5 hours. I suspect this is simple, but I can’t figure it out.

If I follow correctly, using start/end date-type values 7.5 hours (7h30m0s) apart:

Here is the code from the grab:

$MyInterval = interval($StartDate,$EndDate);
$MyNumber=($MyInterval.hour*60)+$MyInterval.minute;
$MyNumber2=$MyInterval.hour+($MyInterval.minute/60);

Does that help?

1 Like