DateTimeFormatInfo.GetAbbreviatedEraName(Int32) 方法

定義

如果縮寫存在,傳回含有指定紀元縮寫名稱的字串。Returns the string containing the abbreviated name of the specified era, if an abbreviation exists.

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

參數

era
Int32

代表紀元的整數。The integer representing the era.

傳回

含有指定紀元縮寫名稱的字串 (如果縮寫存在)。A string containing the abbreviated name of the specified era, if an abbreviation exists.

-或--or-

含有紀元完整名稱的字串 (如果縮寫不存在)。A string containing the full name of the era, if an abbreviation does not exist.

例外狀況

era 不表示 Calendar 屬性所指定曆法的有效紀元。era does not represent a valid era in the calendar specified in the Calendar property.

備註

紀元名稱是行事曆用來參考從固定點或事件全盛時期來勢洶洶之時間週期的名稱。The era name is the name a calendar uses to refer to a period of time reckoned from a fixed point or event. 例如,「西元」For example, "A.D." 或「西元」or "C.E." 是西曆中目前的紀元。is the current era in the Gregorian calendar.

era 的有效值會列在衍生自 Calendar之適當類別的 Eras 屬性中。The valid values for era are listed in the Eras property of the appropriate class derived from Calendar. 例如: JapaneseCalendar.Eras 會顯示此實作為支援的紀元清單。For example: JapaneseCalendar.Eras displays a list of eras that are supported by this implementation.

JapaneseCalendar 類別中,縮寫的紀元名稱是完整紀元名稱的第一個字元。In the JapaneseCalendar class, the abbreviated era name is the first character of the full era name. 此字元可以是單一字元不區分大小寫的拉丁字母縮寫或單一字元的漢字縮寫。This character is either the single-character case-insensitive Latin alphabet abbreviation or the single-character Kanji abbreviation.

給呼叫者的注意事項

如果 CalendarTaiwanCalendar,但 CurrentCulture 不是 "zh-臺灣",則 NativeCalendarNameGetEraName(Int32)GetAbbreviatedEraName(Int32) 會傳回空字串("")。If Calendar is the TaiwanCalendar but the CurrentCulture is not "zh-TW", then NativeCalendarName, GetEraName(Int32), and GetAbbreviatedEraName(Int32) return an empty string ("").

適用於

另請參閱