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.

调用方说明

如果 CalendarTaiwanCalendarCurrentCulture 不是 "zh-chs",则 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 ("").

适用于

另请参阅