Convert Seconds to Minutes & Seconds

T

Turner

There must be a better way to do this. But, this was all
I could come up with.

Thaks; Dean

Public Function ConvertSeconds(sngSeconds As Single)
On Error GoTo err_ConvertSeconds

Dim byMinutes As Byte

Do Until sngSeconds < 60
sngSeconds = sngSeconds - 60
byMinutes = byMinutes + 1
Loop

ConvertSeconds = byMinutes & " Minutes " & sngSeconds
& " Seconds"

exit_ConvertSeconds:
Exit Function

err_ConvertSeconds:

Call MyErrorHandler(Me.Name, "ConvertSeconds",
Err.Description, Err.number, gSTMESSAGERESPONSE)
Resume exit_ConvertSeconds

End Function
 
A

Allen Browne

Integer division and the Mod operator can display seconds as Min:Sec:
=[Seconds] \ 60 & Format([Seconds] Mod 60, "\:00")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top