Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DateTimeFormatInfo.MonthDayPattern Property

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.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)
public string MonthDayPattern { get; set; }

Property Value

Type: System.String
The custom format string for a month and day value, which is associated with the "m" and "M" standard format strings.
ExceptionCondition
ArgumentNullException

An attempt was made to set the property to null.

InvalidOperationException

The DateTimeFormatInfo object is read-only.

See Custom Date and Time Format Strings for custom date and time format specifiers that can be combined to form custom format strings such as "MMMM dd".

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

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
*/


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.