@CalendarType(value="dangi") public final class KoreanCalendar extends EastAsianCalendar<KoreanCalendar.Unit,KoreanCalendar> implements LocalizedPatternSupport
Represents the traditional Koran calendar supported in the gregorian range 1645-01-28/3000-01-27.
It is a lunisolar calendar which defines years consisting of 12 or 13 months. See also Wikipedia.
DAY_OF_WEEKDAY_OF_MONTHDAY_OF_YEARWEEKDAY_IN_MONTHMONTH_OF_YEARMONTH_AS_ORDINALSOLAR_TERMYEAR_OF_CYCLEYEAR_OF_ERACYCLEERAFurthermore, all elements defined in KoreanEra, EpochDays
and CommonElements are supported.
ChronoFormatter<KoreanCalendar> formatter =
ChronoFormatter.setUp(KoreanCalendar.axis(), Locale.ENGLISH)
.addPattern("EEE, d. MMMM U(r)", PatternType.CLDR_DATE).build();
PlainDate today = SystemClock.inLocalView().today();
KoreanCalendar koreanDate = today.transform(KoreanCalendar.class);
System.out.println(formatter.format(koreanDate));
Locale locale = Locale.forLanguageTag("en-u-ca-dangi");
ChronoFormatter<CalendarDate> f = ChronoFormatter.ofGenericCalendarStyle(DisplayMode.FULL, locale);
assertThat(
f.format(PlainDate.of(2017, 10, 1)),
is("Sunday, Eighth Month 12, 2017(dīng-yǒu)"));
ChineseCalendar,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
KoreanCalendar.Unit
Defines some calendar units for the Korean calendar.
|
| Modifier and Type | Field and Description |
|---|---|
static ChronoElement<Integer> |
CYCLE
Represents the cycle number related to the introduction of sexagesimal cycles
by the legendary yellow emperor Huang-Di on -2636-02-15 (gregorian).
|
static StdCalendarElement<Integer,KoreanCalendar> |
DAY_OF_MONTH
Represents the Korean day of month.
|
static StdCalendarElement<Weekday,KoreanCalendar> |
DAY_OF_WEEK
Represents the Korean day of week.
|
static StdCalendarElement<Integer,KoreanCalendar> |
DAY_OF_YEAR
Represents the Korean day of year.
|
static ChronoElement<KoreanEra> |
ERA
Represents the Korean era.
|
static StdCalendarElement<Integer,KoreanCalendar> |
MONTH_AS_ORDINAL
Represents the ordinal index of a Korean month in the range
1-12/13. |
static TextElement<EastAsianMonth> |
MONTH_OF_YEAR
Represents the Korean month.
|
static ChronoElement<SolarTerm> |
SOLAR_TERM
Represents the solar term as one of 24 possible stations of the sun on the ecliptic.
|
static OrdinalWeekdayElement<KoreanCalendar> |
WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
|
static TextElement<CyclicYear> |
YEAR_OF_CYCLE
Represents the Korean year related to the current sexagesimal cycle.
|
static ChronoElement<Integer> |
YEAR_OF_ERA
Represents the Korean year related to the Korean era.
|
| Modifier and Type | Method and Description |
|---|---|
static TimeAxis<KoreanCalendar.Unit,KoreanCalendar> |
axis()
Returns the associated time axis.
|
static Weekmodel |
getDefaultWeekmodel()
Obtains the standard week model of this calendar.
|
static boolean |
isValid(EastAsianYear year,
EastAsianMonth month,
int dayOfMonth)
Queries if given parameter values form a well defined calendar date.
|
static KoreanCalendar |
nowInSystemTime()
Obtains the current calendar date in system time.
|
static KoreanCalendar |
of(EastAsianYear year,
EastAsianMonth month,
int dayOfMonth)
Creates a new instance of a Korean calendar date.
|
static KoreanCalendar |
ofNewYear(int gregorianYear)
Creates a new instance of a Korean calendar date on traditional New Year.
|
at, atTime, equals, findLeapMonth, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysSinceEpochUTC, getMonth, getSexagesimalDay, getSexagesimalMonth, getSolarTerm, getYear, hashCode, isLeapYear, lengthOfMonth, lengthOfYear, toString, withBeginOfNextLeapMonthcompareTo, isAfter, isBefore, isSimultaneous, minus, plusmax, min, minus, minus, plus, plus, until, untilcontains, get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, withgetFormatPattern, getFormatPattern, useDynamicFormatPatternfrom, from, from, transform, transform, transform, transform, transform, transformisAfterAll, isAfterOrEqual, isBeforeAll, isBeforeOrEqual@FormattableElement(format="G") public static final ChronoElement<KoreanEra> ERA
Represents the Korean era.
This element is effectively read-only. Its value cannot be changed in a direct and meaningful way.
The dangi era can also be used in conjunction with PlainDate.
YEAR_OF_ERApublic static final ChronoElement<Integer> CYCLE
Represents the cycle number related to the introduction of sexagesimal cycles by the legendary yellow emperor Huang-Di on -2636-02-15 (gregorian).
This kind of counting is NOT in common use in Korea and only offered for technical reasons. Prefer just the cyclic year together with the related gregorian year instead.
@FormattableElement(format="y") public static final ChronoElement<Integer> YEAR_OF_ERA
Represents the Korean year related to the Korean era.
This kind of year counting is NOT in common use in Korea today and only
offered for historical reasons. Prefer the cyclic year instead. The dangi era
can also be used in conjunction with PlainDate. It was in use in South Korea
from 1952 until 1961:
ChronoFormatter<PlainDate> f =
ChronoFormatter.setUp(PlainDate.axis(), Locale.ENGLISH)
.addText(KoreanEra.DANGI.era())
.addLiteral(" ")
.addInteger(KoreanEra.DANGI.yearOfEra(), 1, 4)
.addPattern(", MM/dd", PatternType.CLDR)
.build();
assertThat(
f.format(PlainDate.of(2018, 10, 1)),
is("Dangi 4351, 10/01"));
assertThat(
f.parse("Dangi 4351, 10/01"),
is(PlainDate.of(2018, 10, 1)));
ERA,
YEAR_OF_CYCLE@FormattableElement(format="U") public static final TextElement<CyclicYear> YEAR_OF_CYCLE
Represents the Korean year related to the current sexagesimal cycle.
This is the standard way to specify a Korean year.
public static final ChronoElement<SolarTerm> SOLAR_TERM
Represents the solar term as one of 24 possible stations of the sun on the ecliptic.
ChineseCalendar.SOLAR_TERM@FormattableElement(format="M", alt="L") public static final TextElement<EastAsianMonth> MONTH_OF_YEAR
Represents the Korean month.
public static final StdCalendarElement<Integer,KoreanCalendar> MONTH_AS_ORDINAL
Represents the ordinal index of a Korean month in the range 1-12/13.
This element can be used in conjunction with
ordinal formatting.
@FormattableElement(format="d") public static final StdCalendarElement<Integer,KoreanCalendar> DAY_OF_MONTH
Represents the Korean day of month.
Months have either 29 or 30 days.
@FormattableElement(format="D") public static final StdCalendarElement<Integer,KoreanCalendar> DAY_OF_YEAR
Represents the Korean day of year.
@FormattableElement(format="E") public static final StdCalendarElement<Weekday,KoreanCalendar> DAY_OF_WEEK
Represents the Korean day of week.
If the day-of-week is set to a new value then Time4J handles the Korean calendar week as starting on Sunday (like in South-Korea).
@FormattableElement(format="F") public static final OrdinalWeekdayElement<KoreanCalendar> WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
public static KoreanCalendar ofNewYear(int gregorianYear)
Creates a new instance of a Korean calendar date on traditional New Year.
gregorianYear - gregorian calendar yearKoreanCalendarIllegalArgumentException - in case of any inconsistenciespublic static KoreanCalendar of(EastAsianYear year, EastAsianMonth month, int dayOfMonth)
Creates a new instance of a Korean calendar date.
year - references the year using different systems like eras or sexagesimal cyclesmonth - the month which might be a leap monthdayOfMonth - the day of month to be checkedKoreanCalendarIllegalArgumentException - in case of any inconsistenciespublic static KoreanCalendar nowInSystemTime()
Obtains the current calendar date in system time.
Convenient short-cut for: SystemClock.inLocalView().now(KoreanCalendar.axis()).
SystemClock.inLocalView(),
ZonalClock.now(Chronology)public static boolean isValid(EastAsianYear year, EastAsianMonth month, int dayOfMonth)
Queries if given parameter values form a well defined calendar date.
year - the year to be checkedmonth - the month to be checkeddayOfMonth - the day of month to be checkedtrue if valid else falsepublic static Weekmodel getDefaultWeekmodel()
Obtains the standard week model of this calendar.
The Korean calendar usually starts on Sunday (in South Korea).
public static TimeAxis<KoreanCalendar.Unit,KoreanCalendar> axis()
Returns the associated time axis.
Copyright © 2014–2021. All rights reserved.