Advertisement
4_2005-2006 Math/ Dates #160844

Duration calculater

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 ;)

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
<p>Public Function Duration(ByVal InSeconds As Long) As String<br>
Dim Seconds As Long, mins As Long, Hours As Long, Days As Long<br>
Seconds = InSeconds Mod 60<br>
mins = (InSeconds \ 60) Mod 60<br>
Hours = ((InSeconds \ 60) \ 60) Mod 24<br>
Days = ((InSeconds \ 60) \ 60) \ 24<br>
Duration = Days &amp; &quot; days &quot; &amp; Format$(Hours, &quot;00&quot;) &amp; &quot;:&quot; &amp; Format$(mins, &quot;00&quot;) &amp; 
&quot;:&quot; &amp; Format$(Seconds, &quot;00&quot;)<br>
End Function</p>
Original Comments (3)
Recovered from Wayback Machine