DateTimeFormatInfo.MonthDayPattern Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets or sets the custom format string for a month and day value, which is associated with the "m" and "M" standard date and time format strings.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.StringThe custom format string for a month and day value, which is associated with the "m" and "M" standard format strings.
| Exception | Condition |
|---|---|
| ArgumentNullException | An attempt was made to set the property to null. |
| InvalidOperationException | The DateTimeFormatInfo object is read-only. |
The following example displays the value of MonthDayPattern for a few cultures.
using System; using System.Globalization; public class Example { public static void Demo(System.Windows.Controls.TextBlock outputBlock) { // Displays the values of the pattern properties. outputBlock.Text += " CULTURE PROPERTY VALUE" + "\n"; PrintPattern(outputBlock, "en-US"); PrintPattern(outputBlock, "ar-EG"); PrintPattern(outputBlock, "fr-FR"); } public static void PrintPattern(System.Windows.Controls.TextBlock outputBlock, String myCulture) { DateTimeFormatInfo myDTFI = new CultureInfo(myCulture).DateTimeFormat; outputBlock.Text += String.Format(" {0} {1}", myCulture, myDTFI.MonthDayPattern) + "\n"; } } /* The example displays the following output: CULTURE PROPERTY VALUE en-US MMMM dd ar-EG dd MMMM fr-FR d MMMM */
Show: