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)
Namespace: Microsoft.VisualBasic
Module: DateAndTime
Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)
Because TimeString is a member of a module, rather than of a class, you do not need to create an object on which to access TimeString.
Now Property | DateString Property | TimeOfDay Property |