Re: Time calculation

Tech-Archive recommends: Fix windows errors by optimizing your registry



=?Utf-8?B?U3RlZg==?= <Stef@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
news:4830EE50-FA3A-43F5-B174-EB4D27AF7DD3@xxxxxxxxxxxxx:

I could not find your function at Google groups and I still don't
know how to write that function. Thanks anyway!

Didn't take me long. Here it is again. Originally poster march 15,
2004 in a thread titled hours in excess of 24

Feel free to modify it to suit your data.

Public Function sec2dur(seconds As Long) As String
On Error Resume Next

Dim hrs As Long
Dim mins As Integer
Dim secs As Integer

hrs = Int(seconds / 3600)
mins = Int((seconds - (3600 * hrs)) / 60)
secs = seconds - (hrs * 3600 + mins * 60)

sec2dur = Format(hrs, "#,##0") & ":" & Format(mins, "00") & ":" &
Format(secs, "00")

End Function

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages