DateTimeFormatInfo.GetMonthName(Int32) 方法

定义

基于与当前 DateTimeFormatInfo 对象关联的区域性,返回指定月份的区域性特定的全名。Returns the culture-specific full name of the specified month based on the culture associated with the current DateTimeFormatInfo object.

public:
 System::String ^ GetMonthName(int month);
public string GetMonthName (int month);
member this.GetMonthName : int -> string
Public Function GetMonthName (month As Integer) As String

参数

month
Int32

1 到 13 之间的一个整数,用于表示要检索的月份的名称。An integer from 1 through 13 representing the name of the month to retrieve.

返回

String

month 表示的月份的区域性特定的全名。The culture-specific full name of the month represented by month.

例外

month 小于 1 或大于 13。month is less than 1 or greater than 13.

注解

对于默认的固定 DateTimeFormatInfo 对象,此方法从对象返回一个字符串 GregorianCalendarFor the default invariant DateTimeFormatInfo object, this method returns a string from the GregorianCalendar object.

month 返回值Return Value
11 “January”"January"
22 2009"February"
33 致辞"March"
44 四月份"April"
55 有助于"May"
66 六月"June"
77 2001"July"
88 2004"August"
99 九月份"September"
1010 2004"October"
1111 "November"
1212 月份"December"
1313 """"

Calendar 对象可以容纳包含13个月的日历。Calendar objects can accommodate calendars with 13 months. 对于12个月的日历,将始终以第13个月的名称返回空字符串。For 12-month calendars, the empty string is always returned as the name of the 13th month.

适用于

另请参阅