Export (0) Print
Expand All

DateAndTime.DateString Property

Returns or sets a String value representing the current date according to your system.

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

public static string DateString { get; }

Property Value

Type: System.String
Gets a String value representing the current date according to your system.

DateString returns the system date in the MM-dd-yyyy format, which uses the abbreviated month name. The accepted formats for the date are M-d-yyyy, M-d-y, M/d/yyyy, and M/d/y. The DateString property returns the system date in the yyyy-MM-dd format for the zh (Chinese simplified), ko (Korean), and ja (Japanese) system locales if you are running Visual Basic within Silverlight. The system locale is set by using the Clock, Language, and Region item in Control Panel.

NoteNote:

The DateString property returns the system date only in the yyyy-MM-dd format for the zh (Chinese simplified), ko (Korean), and ja (Japanese) system locales if you are running Visual Basic within Silverlight.

To get or set the current system time as a String, use the TimeString 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 date is " & Format(Now, "dddd, d MMM yyyy"))

To access the current system date as a Date, use the Today property.

The following example uses the DateString property to display the current system date.


Dim Msg = "The current date is " & DateString


Silverlight

Supported in: 5, 4, 3

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

Community Additions

ADD
Show:
© 2015 Microsoft