HebrewCalendar.ToFourDigitYear(Int32) 方法

定义

使用 TwoDigitYearMax 属性将指定的年份转换为四位数年份,以确定相应的纪元。

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

从 0 到 99 的两位数年份,或者从 5343 到 5999 的四位数希伯来历年份。

返回

如果 year 参数是两位数年份,则返回值是对应的四位数年份。 如果 year 参数是四位数年份,则返回值是未更改的 year 参数。

例外

year 小于 0。

- 或 -

year 小于 MinSupportedDateTime 或大于 MaxSupportedDateTime

注解

方法 ToFourDigitYear 使用 year 参数、 TwoDigitYearMax 属性和年份来计算 4 位年份。 世纪是通过在该 100 年范围内查找参数的唯一 year 匹配项来确定的。 例如,如果 TwoDigitYearMax 设置为 5729,则 100 年的范围从 5630 到 5729。 因此,值 30 解释为 5630,而值 29 解释为 5729。

TwoDigitYearMax如果 属性具有特殊值 99,则 ToFourDigitYear 方法将忽略 控制面板 中的区域和语言选项中的设置,并返回参数的值year不变。

ToFourDigitYear 支持两位数年份或四位数年份。 传递两位数的年份值 (小于 100) 会导致方法根据 TwoDigitYearMax 表示相应世纪的值将值转换为四位数的值。 如果应用程序提供一个四位数的年份值,该值在支持的日历范围内,该方法 ToFourDigitYear将返回实际输入值。 如果应用程序提供的四位数值超出了支持的日历范围,或者如果它提供负值,则 方法将引发异常。

适用于

另请参阅