DateTimeFormatInfo.GetMonthName(Int32) 方法

定義

根據與目前 DateTimeFormatInfo 物件關聯的文化特性,傳回指定月份的文化特性特有完整名稱。

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 的整數,表示要擷取的月份名稱。

傳回

month 所表示月份的特定文化特性之完整名稱。

例外狀況

month 小於 1 或大於 13。

備註

針對預設的不變異 DateTimeFormatInfo 對象,這個方法會從 GregorianCalendar 對象傳回字串。

month 傳回值
1 "January"
2 “二月”
3 “March”
4 “April”
5 “May”
6 “June”
7 “7 月”
8 “8 月”
9 “9 月”
10 “10 月”
11 “11 月”
12 “December”
13 ""

Calendar 物件可以容納 13 個月的行事曆。 針對12個月行事曆,空字串一律會傳回為第13個月的名稱。

適用於

另請參閱