VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Count elapsed time between two time.

by Herry Hariry Amin (2 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Mon 27th September 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Count elapsed time between two time.

Rate Count elapsed time between two time.



' *******************************************************************
' Function Name : ElapsedTime                                       *
' Created By    : Herry Hariry Amin                                 *
' Email         : [email protected]                                  *
' Language      : VB4, VB5, VB6                                     *
' Example       : sYourVariable = ElapsedTime(tStartTime,tStopTime) *
' *******************************************************************
Dim dtr, dtl, jml As Long
    
    dtl = (Hour(tStart) * 3600) + (Minute(tStart) * 60) + (Second(tStart))
    dtr = (Hour(tStop) * 3600) + (Minute(tStop) * 60) + (Second(tStop))

    If tStop < tStart Then
       jml = 86400
    Else
       jml = 0
    End If
    jml = jml + (dtr - dtl)
    
    ElapsedTime = Format(Str(Int((Int((jml / 3600)) Mod 24))), "00") + ":" + Format(Str(Int((Int((jml / 60)) Mod 60))), "00") + ":" + Format(Str(Int((jml Mod 60))), "00")
     
End Function


Download this snippet    Add to My Saved Code

Count elapsed time between two time. Comments

No comments have been posted about Count elapsed time between two time.. Why not be the first to post a comment about Count elapsed time between two time..

Post your comment

Subject:
Message:
0/1000 characters