Returns or sets a String value representing the current time of day according to your system.
Public Property TimeString As String
Exception type | Error number | Condition |
---|---|---|
5 | Invalid cast. |
TimeString always returns the system time as "HH:mm:ss", which is a 24-hour format.
If you attempt to set TimeString with an invalid value, an InvalidCastException occurs.
To get or set the current system date as a String, use the DateString property.
To access the current system time as a Date, use the TimeOfDay property.
This example uses the TimeString property to display the current system time.
MsgBox("The current time is " & TimeString
)
Now Property | DateString Property | TimeOfDay Property |