I want to be able to do a time calculation that will not let the minutes go over 60. Right I have the get the difference of two times to be something like 10.75 hrs. I want it to be like 10 and 45 minutes. Can I please get some help!!!!!
Don't know if there is an "official" way to do it but, you could create a function that takes in the two times.
Within the function:
1. Determine the difference in minutes. (DateDiff())
2. Divide this by 60.
3. Move the result of Step 2 (eg.10.75) to a text variable.
3. Take the Left(Variable,Len(variable)-3) of this text variable. (Should be 10)
4. Take the Mod of the division of the difference in minutes by 60. The Mod function gives the "remainder" of a division. Since the division is by 60, it gives the number of 60ths of an hour, ie minutes.
5. Concatinate the two with a colin between them and set the function equal to that.
Some options a little easier (& with ref to MichaelRed):
If the period is always less than one day, use: = format(LaterTime - EarlierTime,"hh:mm"
If the period can be mulitple days, use = DateDiff("d",EarlierTime,LaterTime) & " Days, " & format(LaterTime - EarlierTime,"hh:mm"
These can be used directly in the properties of the contol on your form or report.
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.