Public Function basSec2HrMinSec(SecIn As Long) As String
'Michael Red 6/14/02
'Convert Seconsd (as a LONG or Integer) to String like "hh:mm:ss"
'Sample Usage: ? basSec2HrMinSec(450)
'7:30
'? basSec2HrMinSec(450 + 3600 + 86400)
' 25:7:30
'? basSec2HrMinSec(450 + 3600)
'1:7:30
'? basSec2HrMinSec(450 + 10000)
'2:54:10
Dim MyTime As Double
Dim MyHrs As Long
Const SecsPerDay = 86400
'Convert raw seconde to a regular date / time
MyTime = SecIn / SecsPerDay
MyHrs = Int(MyTime * 24)
basSec2HrMinSec = str(MyHrs) & ":" & Format(MyTime, "n:ss")
End Function
]/code]
Od COURSE, as usual the above is intended strrictly for illustration purposes, and NOT for prodution application use. It would require error trapping as well as some rigorous testing prior to any real world application.
MichaelRed
m.red@att.net
There is never time to do it right but there is always time to do it over