SecondsToHMS

From HashVB
Revision as of 03:32, 20 June 2006 by Breadman (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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