EastAsianLunisolarCalendar.ToFourDigitYear(Int32) 方法

定义

将指定的年份转换为四位数的年份。Converts the specified year to a four-digit year.

public:
 override int ToFourDigitYear(int year);
public override int ToFourDigitYear (int year);
override this.ToFourDigitYear : int -> int
Public Overrides Function ToFourDigitYear (year As Integer) As Integer

参数

year
Int32

一个两位数或四位数的整数,用于表示要转换的年份。A two-digit or four-digit integer that represents the year to convert.

返回

一个包含 year 参数的四位数表示形式的整数。An integer that contains the four-digit representation of the year parameter.

异常

year 超出了此日历支持的范围。year is outside the range supported by this calendar.

注解

ToFourDigitYear 方法TwoDigitYearMax使用属性来确定相应的纪元。The ToFourDigitYear method uses the TwoDigitYearMax property to determine the appropriate century.

ToFourDigitYear支持两位数年份或四位数年份。ToFourDigitYear supports either a two-digit year or a four-digit year. 如果传递两位数的年份值 (小于 100), 则会使方法根据TwoDigitYearMax表示适当世纪的值将值转换为四位值。Passing a two-digit year value (less than 100) causes the method to convert the value to a four-digit value according to the TwoDigitYearMax value representing the appropriate century. 如果应用程序提供了在支持的日历范围ToFourDigitYear内的四位数年份值, 则该方法将返回实际输入值。If the application supplies a four-digit year value that is within the supported calendar range to ToFourDigitYear, the method returns the actual input value. 如果应用程序提供了一个在支持的日历范围之外的四位数值, 或者如果它提供负值, 则该方法将引发异常。If the application supplies a four-digit value that is outside the supported calendar range, or if it supplies a negative value, the method throws an exception.

适用于