Duration calculater
Posted: 2003-06-01
By: ArchiveBot
Viewed: 82
Filed Under:
No attachments for this post
This code takes a value of seconds as an input value and then calculates the duration in seconds, minutes, hours and days without using any VB date function. This code runs super fast. I wrote this for my IRC Server and thought it might be any useful for you... if you like it, you may want to vote, if not, well the not, i guess ;)
Original Author: Dennis Fisch
Code
Public Function Duration(ByVal InSeconds As Long) As String
Dim Seconds As Long, mins As Long, Hours As Long, Days As Long
Seconds = InSeconds Mod 60
mins = (InSeconds 60) Mod 60
Hours = ((InSeconds 60) 60) Mod 24
Days = ((InSeconds 60) 60) 24
Duration = Days & " days " & Format$(Hours, "00") & ":" & Format$(mins, "00") &
":" & Format$(Seconds, "00")
End Function
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.