SIBYL System

just technical blog

年号が変わったら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.

年号ベースで番号付けしてる日本のカレンダーを実装してますって書いてありますね。明治より前は登録されていないようです。生年月日での用途が主だからということでしょうかね。

年代(Era)クラス

日本以外にも国独自の表記ってあるんだなー。

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.

Eras 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.

 

 

 - 未分類 ,