SecondsToHMS

From HashVB
Jump to: navigation, search

This function converts seconds to Hours:Minutes:Seconds format very easily. Example:

SecondsToHMS(300000000) = "05:20:00"
Option Explicit

Private Sub Form_Load()
    MsgBox SecondsToHMS(300000000)
End Sub

Public Function SecondsToHMS(strSeconds As Double)
    SecondsToHMS = Format$(DateAdd("s", strSeconds, 0), "hh:mm:ss")
End Function