com.ibm.icu.util
public class JapaneseCalendar extends GregorianCalendar
JapaneseCalendar
is a subclass of GregorianCalendar
that numbers years and eras based on the reigns of the Japanese emperors.
The Japanese calendar is identical to the Gregorian calendar in all respects
except for the year and era. The ascension of each emperor to the throne
begins a new era, and the years of that era are numbered starting with the
year of ascension as year 1.
Note that in the year of an imperial ascension, there are two possible sets of year and era values: that for the old era and for the new. For example, a new era began on January 7, 1989 AD. Strictly speaking, the first six days of that year were in the Showa era, e.g. "January 6, 64 Showa", while the rest of the year was in the Heisei era, e.g. "January 7, 1 Heisei". This class handles this distinction correctly when computing dates. However, in lenient mode either form of date is acceptable as input.
In modern times, eras have started on January 8, 1868 AD, Gregorian (Meiji),
July 30, 1912 (Taisho), December 25, 1926 (Showa), and January 7, 1989 (Heisei). Constants
for these eras, suitable for use in the ERA
field, are provided
in this class. Note that the number used for each era is more or
less arbitrary. Currently, the era starting in 1053 AD is era #0; however this
may change in the future as we add more historical data. Use the predefined
constants rather than using actual, absolute numbers.
This class should not be subclassed.
JapaneseCalendar usually should be instantiated using
{@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a ULocale
with the tag "@calendar=japanese"
.
See Also: GregorianCalendar
UNKNOWN: ICU 2.8
Field Summary | |
---|---|
static int | CURRENT_ERA |
static int | HEISEI
Constant for the era starting on Jan. |
static int | MEIJI
Constant for the era starting on Sept. |
static int | SHOWA
Constant for the era starting on Dec. |
static int | TAISHO
Constant for the era starting on July 30, 1912 AD. |
Constructor Summary | |
---|---|
JapaneseCalendar()
Constructs a default JapaneseCalendar using the current time
in the default time zone with the default locale. | |
JapaneseCalendar(TimeZone zone)
Constructs a JapaneseCalendar based on the current time
in the given time zone with the default locale. | |
JapaneseCalendar(Locale aLocale)
Constructs a JapaneseCalendar based on the current time
in the default time zone with the given locale. | |
JapaneseCalendar(ULocale locale)
Constructs a JapaneseCalendar based on the current time
in the default time zone with the given locale. | |
JapaneseCalendar(TimeZone zone, Locale aLocale)
Constructs a JapaneseCalendar based on the current time
in the given time zone with the given locale.
| |
JapaneseCalendar(TimeZone zone, ULocale locale)
Constructs a JapaneseCalendar based on the current time
in the given time zone with the given locale.
| |
JapaneseCalendar(Date date)
Constructs a JapaneseCalendar with the given date set
in the default time zone with the default locale.
| |
JapaneseCalendar(int era, int year, int month, int date)
Constructs a JapaneseCalendar with the given date set
in the default time zone with the default locale.
| |
JapaneseCalendar(int year, int month, int date)
Constructs a JapaneseCalendar with the given date set
in the default time zone with the default locale.
| |
JapaneseCalendar(int year, int month, int date, int hour, int minute, int second)
Constructs a JapaneseCalendar with the given date
and time set for the default time zone with the default locale.
|
Method Summary | |
---|---|
protected int | getDefaultDayInMonth(int extendedYear, int month)
Called by handleComputeJulianDay. |
protected int | getDefaultMonthInYear(int extendedYear)
Called by handleComputeJulianDay. |
String | getType()
Return the current Calendar type. |
protected void | handleComputeFields(int julianDay) |
protected int | handleGetExtendedYear() |
protected int | handleGetLimit(int field, int limitType)
Override GregorianCalendar. |
UNKNOWN: ICU 2.8
UNKNOWN: ICU 2.8
UNKNOWN: ICU 2.8
UNKNOWN: ICU 2.8
UNKNOWN: ICU 2.8
JapaneseCalendar
using the current time
in the default time zone with the default locale.UNKNOWN: ICU 2.8
JapaneseCalendar
based on the current time
in the given time zone with the default locale.Parameters: zone the given time zone.
UNKNOWN: ICU 2.8
JapaneseCalendar
based on the current time
in the default time zone with the given locale.Parameters: aLocale the given locale.
UNKNOWN: ICU 2.8
JapaneseCalendar
based on the current time
in the default time zone with the given locale.Parameters: locale the given ulocale.
UNKNOWN: ICU 3.2 This API might change or be removed in a future release.
JapaneseCalendar
based on the current time
in the given time zone with the given locale.
Parameters: zone the given time zone. aLocale the given locale.
UNKNOWN: ICU 2.8
JapaneseCalendar
based on the current time
in the given time zone with the given locale.
Parameters: zone the given time zone. locale the given ulocale.
UNKNOWN: ICU 3.2 This API might change or be removed in a future release.
JapaneseCalendar
with the given date set
in the default time zone with the default locale.
Parameters: date The date to which the new calendar is set.
UNKNOWN: ICU 2.8
JapaneseCalendar
with the given date set
in the default time zone with the default locale.
Parameters: era The imperial era used to set the calendar's {@link #ERA ERA} field. Eras are numbered starting with the Tenki era, which began in 1053 AD Gregorian, as era zero. Recent eras can be specified using the constants {@link #MEIJI} (which started in 1868 AD), {@link #TAISHO} (1912 AD), {@link #SHOWA} (1926 AD), and {@link #HEISEI} (1989 AD). year The value used to set the calendar's {@link #YEAR YEAR} field, in terms of the era. month The value used to set the calendar's {@link #MONTH MONTH} field. The value is 0-based. e.g., 0 for January. date The value used to set the calendar's DATE field.
UNKNOWN: ICU 2.8
JapaneseCalendar
with the given date set
in the default time zone with the default locale.
Parameters: year The value used to set the calendar's {@link #YEAR YEAR} field, in the era Heisei, the most current at the time this class was last updated. month The value used to set the calendar's {@link #MONTH MONTH} field. The value is 0-based. e.g., 0 for January. date The value used to set the calendar's {@link #DATE DATE} field.
UNKNOWN: ICU 2.8
JapaneseCalendar
with the given date
and time set for the default time zone with the default locale.
Parameters: year The value used to set the calendar's {@link #YEAR YEAR} time field, in the era Heisei, the most current at the time of this writing. month The value used to set the calendar's {@link #MONTH MONTH} time field. The value is 0-based. e.g., 0 for January. date The value used to set the calendar's {@link #DATE DATE} time field. hour The value used to set the calendar's {@link #HOUR_OF_DAY HOUR_OF_DAY} time field. minute The value used to set the calendar's {@link #MINUTE MINUTE} time field. second The value used to set the calendar's {@link #SECOND SECOND} time field.
UNKNOWN: ICU 2.8
Parameters: extendedYear the extendedYear, as returned by handleGetExtendedYear month the month, as returned by getDefaultMonthInYear
Returns: the default day of the month
See Also: JapaneseCalendar
UNKNOWN: ICU 3.6 ICU 3.6
Parameters: extendedYear the extendedYear, as returned by handleGetExtendedYear
Returns: the default month
See Also: JapaneseCalendar
UNKNOWN: ICU 3.6 ICU 3.6
Deprecated: This API is ICU internal only.
Return the current Calendar type.Returns: type of calendar (gregorian, etc.)
UNKNOWN: ICU 3.0
UNKNOWN: ICU 2.8
UNKNOWN: ICU 2.8
UNKNOWN: ICU 2.8