しびら

# 年号が変わったらJavaのCalendarの和暦変換はどうなるのか

と仕事中にふと思った。

コードを探してみたらあった。

http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/JapaneseImperialCalendar.java#JapaneseImperialCalendar

クラスについて

`JapaneseImperialCalendar` implements a Japanese calendar system in which the imperial era-based year numbering is supported from the Meiji era. The following are the eras supported by this calendar system.

The class `Era` represents a calendar era that defines a period of time in which the same year numbering is used. For example, Gregorian year 2004 is Heisei 16 in the Japanese calendar system. An era starts at any point of time (Gregorian) that is represented by `CalendarDate`.

`Era`s that are applicable to a particular calendar system can be obtained by calling `CalendarSystem.getEras()` one of which can be used to specify a date in `CalendarDate`.

The following era names are defined in this release.