DateAndTime.TimeString Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns or sets a String value representing the current time of day according to your system.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Syntax

'Declaration
Public Shared ReadOnly Property TimeString As String
public static string TimeString { get; }

Property Value

Type: System.String
Gets a String value representing the current time of day according to your system.

Remarks

TimeString always returns the system time as "HH:mm:ss", which is a 24-hour format. This format is culture-invariant, which means it does not change even if you change the Regional Options in Control Panel.

To get the current system date as a String, use the DateString property.

To get the current system date or time in the format of your locale, or in a custom format, supply the Now property to the Format function. The following example demonstrates this.

MsgBox("The formatted time is " & Format(Now, "hh.mm.ss.fff tt"))

To access the current system time as a Date, use the TimeOfDay property.

Examples

This example uses the TimeString property to display the current system time.

Dim Msg = "The current time is " & TimeString

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.