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

Recommended Answers

All 2 Replies

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.

thank nutster.... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.