This documentation is archived and is not being maintained.

DateTimeFormatInfo.DateSeparator Property

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

[Visual Basic]
Public Property DateSeparator As String
[C#]
public string DateSeparator {get; set;}
[C++]
public: __property String* get_DateSeparator();
public: __property void set_DateSeparator(String*);
[JScript]
public function get DateSeparator() : String;
public function set DateSeparator(String);

Property Value

The string that separates the components of a date; that is, the year, month, and day. The default for InvariantInfo is "/".

Exceptions

Exception Type Condition
ArgumentNullException The property is being set to a null reference (Nothing in Visual Basic).
InvalidOperationException The property is being set and the DateTimeFormatInfo is read-only.

Remarks

If the custom pattern includes the format pattern "/", DateTime.ToString displays the value of DateSeparator in place of the "/" in the format pattern.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

DateTimeFormatInfo Class | DateTimeFormatInfo Members | System.Globalization Namespace | TimeSeparator

Show: