System.Globalization.DateTimeFormatInfo.DateSeparator Property

Gets or sets the string that separates the components of a date, that is, the year, month, and day.

Syntax

public string DateSeparator { get; set; }

Value

The string to use to separate the year, month and day components of a date.

Exceptions

TypeReason
ArgumentNullExceptionThe value specified for a set operation is a null reference.
InvalidOperationExceptionThe current instance is read-only and a set operation was attempted.

Remarks

If a custom format string includes the "/" format specifier, the DateTime.ToString method displays the value of DateTimeFormatInfo.DateSeparator in place of the "/" in the result string.

The DateTimeFormatInfo.DateSeparator property defines the string that replaces the date separator ("/" custom date and time format specifier) in a result string in a formatting operation. It also defines the date separator string in a parsing operation.

Requirements

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0