Hey, I faced one tiny problem, but I can't figure it out. What I need is basically "label1 = format(now, "hh:mm:ss")", but I want start counting time from zero: "00:00:00".. Any help?

Recommended Answers

All 4 Replies

Capture start time into a variable and use datediff function to test the difference returning seconds mod 60 returns minutes mod 60 returns hours. Understand?

Good Luck

Use a Timer control in your form. Then write the below code:

Dim Start_Time As String


Private Sub Form_Load()
Start_Time = Time
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
Me.Caption = "Elapsed Time: " & Format(DateAdd("s", DateDiff("s", Start_Time, Time), "0:0:0"), "hh:mm:ss")
End Sub

Thanks a lot guys

Welcome... :)

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.