How can I format the output of subtracting two times as a time value. For instance 10:00 am - 9:00 AM = 1 (where I want to show the output as "1").
How can I format the output of subtracting two times as a time value. For instance 10:00 am - 9:00 AM = 1 (where I want to show the output as "1").
Are you using DateDiff() function?
Converting the double value to a clock format requires an expression or custom function. See post 9 in https://www.accessforums.net/access/...ime-38266.html
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi June7! I just tried DateDiff and that gets me pretty close. Can you advise on what interval to use in order to get the time in minutes. "h" works fine but rounds too high. "hh:nn" drops an error.
"n" for minutes because "m" is already reserved for months.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
June7, yes I am using hh:nn (i also tried h:n) but thats erroring out in the field.
Neither of those is valid parameter for the DateDiff function.
Did you look at the link in post 2?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
June7,
I re-read your other post but I didn't follow the formula you have there and the article on Access KB wasn't very useful for formatting as hh:mm.
Thanks,
Use of DateDiff() is clearly demonstrated.
The conversion example given is for converting seconds to HH:mm:SS.
The expression will have to be adjusted for converting minutes to HH:MM.
DateDiff("n", enddate, startdate) will return total minutes
x = elapsed time in decimal minutes
Int(x / 60) & ":" & Int(x mod 60)
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.