asp.net.ph

DateTimeFormatInfo.MonthNames Property

System.Globalization Namespace   DateTimeFormatInfo Class


Sets or retrieves a one-dimensional array of type String containing the culture-specific full names of the months.

[ VB ]
public Property MonthNames As String ( ) 

[ C# ]
public string [ ] MonthNames {get; set;}

[ C++ ]
public: __property String* get_MonthNames ( );
public: __property void set_MonthNames ( String* __gc [ ] );

[ JScript ]
function get MonthNames ( ) : String [ ];
public function set MonthNames ( String [ ] );

Property Value

A one-dimensional array of type String containing the culture-specific full names of the months. In a 12-month calendar, the 13th element of the array is an empty string. The array for InvariantInfo contains "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", and "".

Exceptions


Exception Type Condition
ArgumentNullException The property is being set to a null reference ( Nothing in Visual Basic ).
ArgumentException The property is being set to an array that is multidimensional or whose length is not exactly 13.
InvalidOperationException The property is being set and the DateTimeFormatInfo is read-only.

Remarks

If setting this property, the array must be one-dimensional and must have exactly 13 elements. Calendar objects accommodate calendars with 13 months.

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

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

Example

This example shows how you can create a DateTimeFormatInfo object for a given culture, to gain access to the MonthNames property for the specified culture.

First, you need to instantiate a CultureInfo object with the specified culture name, and then retrieve the CultureInfo.DateTimeFormat property.

This returns a DateTimeFormatInfo instance specific to the given culture, which you can then use to get to any DateTimeFormatInfo method or property, such as MonthNames.

 Show me 

See Also

DateTimeFormatInfo Members   DayNames   AbbreviatedMonthNames   GetMonthName Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph