System.Globalization.JapaneseCalendar.GetEra Method

Returns the era in the specified DateTime.

Syntax

public override int GetEra (DateTime time)

Parameters

time
The DateTime to read.

Returns

An integer that represents the era in the specified DateTime.

Remarks

The Japanese calendar recognizes one era for every emperor's reign. The current era is the Heisei era, which began in the Gregorian calendar year 1989. The era name is typically displayed before the year. For example, the Gregorian calendar year 2001 is the Japanese calendar year Heisei 13. Note that the first year of an era is called "Gannen." Therefore, the Gregorian calendar year 1989 was the Japanese calendar year Heisei Gannen.

This class assigns numbers to the eras as follows:

4

平成 (Heisei)

平 (H, h)

January 8, 1989 to present

3

昭和 (Showa)

昭 (S, s)

December 25, 1926 to January 7, 1989

2

大正 (Taisho)

大 (T, t)

July 30, 1912 to December 24, 1926

1

明治 (Meiji)

明 (M, m)

September 8, 1868 to July 29, 1912

Ordinarily, the System.Globalization.JapaneseCalendar class supports dates from September 8 in the year Meiji 1 (September 8, 1868 of the Gregorian calendar), which is the value of the JapaneseCalendar.MinSupportedDateTime property. However, the JapaneseCalendar.GetEra(DateTime) method successfully returns the era for dates from January 1 through September 7 in the year Meiji 1 (January 1, 1868 through September 7, 1868 in the Gregorian calendar). For dates earlier than January 1, 1868 in the Gregorian calendar, the method throws an ArgumentOutOfRangeException exception.

Requirements

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0