J
Joe
I am attempting to solve a simple floating point math problem
and I am not getting the results that I think I should be getting.
Here is what I am doing:
Dim iMinutes As Integer
Dim dHours, dMinutes, dUnits As Double
iMinutes = DateDiff(DateInterval.Minute, dStartTime,
dEndTime)
dHours = iMinutes \ 60
dMinutes = iMinutes Mod 60
dUnits = dHours + (dMinutes \ 60.0)
My input start time is 9:00AM and my ending time is 10:15AM
dHours = 1 (good)
dMinutes = 15 (good)
dUnits = 1 (not good, should be 1.25)
Can someone tell me what I am doing wrong? It seems like I cannot
get any numbers to the right of the decimal point for dUnits.
and I am not getting the results that I think I should be getting.
Here is what I am doing:
Dim iMinutes As Integer
Dim dHours, dMinutes, dUnits As Double
iMinutes = DateDiff(DateInterval.Minute, dStartTime,
dEndTime)
dHours = iMinutes \ 60
dMinutes = iMinutes Mod 60
dUnits = dHours + (dMinutes \ 60.0)
My input start time is 9:00AM and my ending time is 10:15AM
dHours = 1 (good)
dMinutes = 15 (good)
dUnits = 1 (not good, should be 1.25)
Can someone tell me what I am doing wrong? It seems like I cannot
get any numbers to the right of the decimal point for dUnits.