Returns a Double value representing the number of seconds elapsed since midnight.
ReadOnly Public Property Timer() As Double
The Timer property returns both the seconds and the milliseconds since midnight. The seconds are in the integral part of the return value, and the milliseconds are in the fractional part.
This example uses the Timer function to pause the application. It can perform other processing during the pause.
Dim Start, Finish, TotalTime As Double
If (MsgBox("Press Yes to pause for 5 seconds", MsgBoxStyle.YesNo)) = _
MsgBoxResult.Yes Then
Start = Timer ' Set start time (seconds).
Finish = Start + 5.0 ' Set end time for 5-second duration.
Do While Timer < Finish
' Do other processing while waiting for 5 seconds to elapse.
Loop
TotalTime = Timer - Start ' Calculate total time.
MsgBox "Paused for " & TotalTime & " seconds"
Else
End
End If
Randomize Statement | TimeOfDay Property | Today Property |