0

hi...

how to calculate the difference between time 1 and time 2 ... and how to get the current time without moving "second"

coding that I do now makes a ticking time and can not do subtraction between the time ...

I really appreciate your help

Private Sub Command1_Click()
Timer1.Enabled = True

End Sub

Private Sub Command2_Click()
Timer2.Enabled = True

End Sub


Private Sub Timer1_Timer()
Label3.Caption = Time
Label4.Caption = Date
End Sub


Private Sub Timer2_Timer()
Label5.Caption = Time
Label7.Caption = Date

Dim nSec As Integer
nSec = DateDiff("s", Label3, Label5)
Label9.Caption = nSec


End Sub
2
Contributors
2
Replies
25
Views
3 Years
Discussion Span
Last Post by ctrah
0

If you do not want the times to be constantly updated, do not use Timer controls. Use built-in Date functions instead. Timers are used when you want something to keep happening over and over, not for one-time operations.

If you want to see the time difference between when you pressed two buttons, then record the times you clicked them in Date variables that are defined at the form level then compare the Date variable, not labels, using DateDiff after both dates are set.

Edited by Nutster: Clear it up a bit. Remove extra sample code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.