summing hours and minutes

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I have a database storing information about a music
library. One field keeps track of the total playing time
of the CD. Problem - there are 60 minutes in an hour, not
100. Is there some way that I can store the unit's playing
time in hours and minutes and then create reports
accurately summing the field?
(i.e., 0.45 + 0.45 = 1h30m not .9hr)
 
It is probably easiest to store that data as the smallest unit available,
minutes or seconds, then format it when you need it.

If in minutes and to display as hours and minutes:

=[TimeField]\60 & "h" & [TimeField] Mod 60 & "m"

The back slash "\" is intentional, it is "integer division".

If you store the data in seconds:

=[TimeField]\3600 & "h" & ([TimeField]\60) Mod 60 & "m" & [TimeField] Mod
3600 Mod 60 & "s"
 
I have a database storing information about a music
library. One field keeps track of the total playing time
of the CD. Problem - there are 60 minutes in an hour, not
100. Is there some way that I can store the unit's playing
time in hours and minutes and then create reports
accurately summing the field?
(i.e., 0.45 + 0.45 = 1h30m not .9hr)

I'd suggest instead storing the duration in minutes, rather than
misusing base 10 numbers as if they were Babylonian Base 60. If you
store 90 minutes in a Long Integer field you can use an expression

[PlayingTime] \ 60 & Format([Playing Time] MOD 60, "h00m")

to display it as 1h30m.
 
Back
Top