Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change hours to time parts

Dates and Time

Change hours to time parts

by  SBerthold  Posted    (Edited  )
For exmaple:

36 hours 54 minutes and 23 seconds

in hours would be

= 36 + (54/60) + (23/3600)
or
= 36.9064 (36.9063888888889)


[color blue]
Code:
Public Function HoursToTimeParts(Hours As Double) As String
    HoursToTimeParts = Int(Hours) & "hrs " & Format$(CDate(Hours / 24), "nn\m\i\n\s ss\s\e\c\s")
End Function
[/color]

?HoursToTimeParts(36.9064)

returns: 36 hours 54 minutes and 23 seconds
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top