This documentation is archived and is not being maintained.

DateTimeFormatInfo::ShortDatePattern Property

Gets or sets the format pattern for a short date value, which is associated with the "d" format pattern.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

public:
property String^ ShortDatePattern {
	String^ get ();
	void set (String^ value);
}

Property Value

Type: System::String
The format pattern for a short date value, which is associated with the "d" format pattern.

ExceptionCondition
ArgumentNullException

The property is being set to nullptr.

InvalidOperationException

The property is being set and the DateTimeFormatInfo object is read-only.

See Custom Date and Time Format Strings for patterns that can be combined to construct custom patterns, for example, "MM/dd/yyyy".

This property is affected if the value of the Calendar property changes.

The DateSeparator property is derived from the ShortDatePattern property. Your applications are recommended to set the short date pattern to the exact value of interest, instead of attempting to have the date separator replaced. For example, to obtain the pattern MM-DD-yyyy, the application should set "MM-DD-yyyy" specifically. This also permits the setting of patterns such as "MM/DD, yyyy" that don't contain a traditional separator between all parts of the format.

The following example displays the value of the ShortDatePattern property and the value of a date formatted using the ShortDatePattern property for a few cultures.

No code example is currently available or this language may not be supported.

The following example modifies the ShortDatePattern property of a DateTimeFormatInfo object that represents the formatting conventions of the English (United States) culture. It also displays a date value twice, first to reflect the original ShortDatePattern property and then to reflect the new property value.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: