I have used this routine to extract the mins and hours from
starttime and endtime:
timeused=Format([StartTime]-1-[EndTime],"Short Time" and
the result is for example 03:15.
How to convert this result into minutes ?
If you have a string "timeused" containing hours and minutes in the format "hh:mm", you can convert it to minutes with the following expression:
Val(Left$(timeused,2)) * 60 + Val(Mid$(timeused,4,2))
I don't understand your calculation (StartTime-1-EndTime) of timeused, however. Shouldn't it be EndTime-StartTime?
Anyway, while the string method will work, it's actually much simpler to just convert the time value directly into minutes with:
(EndTime - StartTime) * 1440.0
That will give you a floating point result in minutes and fractional minute, which you can round if you wish. Rick Sprague
You could also use the DateDiff function DATEDIFF("S", [StartTime], [EndTime])/60 This will break it all the way down by the second (still show it in hours and minutes)
Change the "s" to "m" for minutes /1440
(Not sure about dividing by 1440, been a while since I've used it)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.