Export (0) Print
Expand All

DateTimeFormatInfo.AbbreviatedMonthGenitiveNames Property

Gets or sets a string array of abbreviated month names associated with the current DateTimeFormatInfo object.

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

[ComVisibleAttribute(false)]
public string[] AbbreviatedMonthGenitiveNames { get; set; }

Property Value

Type: System.String[]
A string array of abbreviated month names.

ExceptionCondition
ArgumentException

In a set operation, the array is multidimensional or has a length that is not exactly 13.

ArgumentNullException

In a set operation, the value array or one of the elements of the value array is null.

InvalidOperationException

The DateTimeFormatInfo object is read-only.

In some languages, a month name that is part of a date appears in the genitive case. For example, a date in the Russian (Russia) or "ru-RU" culture consists of the day number and the genitive month name, such as 1 Января (1 January).

In a set operation, the array must be one-dimensional and must have exactly 13 elements, because Calendar objects accommodate calendars with 13 months. For 12-month calendars, the thirteenth element should be String.Empty.

If you set the AbbreviatedMonthGenitiveNames property, you must also set the AbbreviatedMonthNames property.

The following example demonstrates several methods and properties that specify date and time format patterns, native calendar name, and full and abbreviated month and day names.


// This example demonstrates the DateTimeFormatInfo 
// MonthGenitiveNames, AbbreviatedMonthGenitiveNames, 
// ShortestDayNames properties.
using System;
using System.Globalization;

class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      string[] myDateTimePatterns = new string[] { "MM/dd/yy", "MM/dd/yyyy" };

      // Get the en-US culture.
      CultureInfo ci = new CultureInfo("en-US");
      // Get the DateTimeFormatInfo for the en-US culture.
      DateTimeFormatInfo dtfi = ci.DateTimeFormat;

      // Display the effective culture.
      outputBlock.Text += String.Format("This example uses the {0} culture.", 
                                        ci.Name) + "\n";

      // Display month genitive names.
      outputBlock.Text += "\nMonthGenitiveNames..." + "\n";
      string monthNamesDisplay = null;
      foreach (string name in dtfi.MonthGenitiveNames)
      {
         if (! String.IsNullOrEmpty(monthNamesDisplay))
            monthNamesDisplay += ", ";
         monthNamesDisplay += String.Format("'{0}'", name);
      }
      outputBlock.Text += monthNamesDisplay + "\n\n";

      // Display abbreviated month genitive names.
      monthNamesDisplay = "";
      outputBlock.Text += "\nAbbreviatedMonthGenitiveNames...\n";
      foreach (string name in dtfi.AbbreviatedMonthGenitiveNames)
      {
         if (! String.IsNullOrEmpty(monthNamesDisplay))
            monthNamesDisplay += ", ";
         monthNamesDisplay += String.Format("'{0}'", name);
      }
      outputBlock.Text += monthNamesDisplay + "\n\n";

      // Display shortest day names.
      string dayNamesDisplay = "";
      outputBlock.Text += "\nShortestDayNames...\n";
      foreach (string name in dtfi.ShortestDayNames)
      {
         if (! String.IsNullOrEmpty(dayNamesDisplay))
            dayNamesDisplay += ", ";
         dayNamesDisplay += String.Format("'{0}'", name);
      }
      outputBlock.Text += dayNamesDisplay + "\n\n";
   }
}
/*
This code example produces the following results:

This code example uses the en-US culture.

MonthGenitiveNames...
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', ''

AbbreviatedMonthGenitiveNames...
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', ''

ShortestDayNames...
'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'
*/


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.

Community Additions

ADD
Show:
© 2014 Microsoft