Time Format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a calculated query field that displays time in decimals and I need to
convert the time format to hours and minutes.

For example:
2.02 hours needs to display as 2:02 (2 hours 2 minutes)
3.32 hours needs to display as 3:19 (3 hours 19 minutes)
0.90 hours needs to display as 0:54 (0 hours 54 minutes)

Thanks for your help!

Scott
 
Simplifying things, times are stored as as fraction of a day.

That means that dividing that numeric value by 24 and formatting it as a
time should give you what you want:

?Format(2.02/24, "hh:nn")
02:01
?Format(3.32/24, "hh:nn")
03:19
?Format(0.9/24, "hh:nn")
00:54

Note that this will only work if you're dealing with less that 24 hours:

?Format(26.02/24, "hh:nn")
02:01
 
It worked perfectly, thank you!

Douglas J. Steele said:
Simplifying things, times are stored as as fraction of a day.

That means that dividing that numeric value by 24 and formatting it as a
time should give you what you want:

?Format(2.02/24, "hh:nn")
02:01
?Format(3.32/24, "hh:nn")
03:19
?Format(0.9/24, "hh:nn")
00:54

Note that this will only work if you're dealing with less that 24 hours:

?Format(26.02/24, "hh:nn")
02:01
 
Back
Top