Class KoreanCalendar

All Implemented Interfaces:
Serializable, Comparable<KoreanCalendar>, CalendarDate, ChronoDisplay, Temporal<CalendarDate>, LocalizedPatternSupport

@CalendarType("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.

Introduction

It is a lunisolar calendar which defines years consisting of 12 or 13 months. See also Wikipedia.

Following elements which are declared as constants are registered by this class

Furthermore, all elements defined in KoreanEra, EpochDays and CommonElements are supported.

Example of usage

     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));
 

Support for unicode ca-extensions

      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)"));
 
Since:
3.40/4.35
Author:
Meno Hochschild
See Also:
ChineseCalendar, Serialized Form
  • Field Details

  • Method Details

    • ofNewYear

      public static KoreanCalendar ofNewYear(int gregorianYear)

      Creates a new instance of a Korean calendar date on traditional New Year.

      Parameters:
      gregorianYear - gregorian calendar year
      Returns:
      new instance of KoreanCalendar
      Throws:
      IllegalArgumentException - in case of any inconsistencies
    • of

      public static KoreanCalendar of(EastAsianYear year, EastAsianMonth month, int dayOfMonth)

      Creates a new instance of a Korean calendar date.

      Parameters:
      year - references the year using different systems like eras or sexagesimal cycles
      month - the month which might be a leap month
      dayOfMonth - the day of month to be checked
      Returns:
      new instance of KoreanCalendar
      Throws:
      IllegalArgumentException - in case of any inconsistencies
    • nowInSystemTime

      public static KoreanCalendar nowInSystemTime()

      Obtains the current calendar date in system time.

      Convenient short-cut for: SystemClock.inLocalView().now(KoreanCalendar.axis()).

      Returns:
      current calendar date in system time zone using the system clock
      See Also:
      SystemClock.inLocalView(), ZonalClock.now(Chronology)
    • isValid

      public static boolean isValid(EastAsianYear year, EastAsianMonth month, int dayOfMonth)

      Queries if given parameter values form a well defined calendar date.

      Parameters:
      year - the year to be checked
      month - the month to be checked
      dayOfMonth - the day of month to be checked
      Returns:
      true if valid else false
    • getDefaultWeekmodel

      public static Weekmodel getDefaultWeekmodel()

      Obtains the standard week model of this calendar.

      The Korean calendar usually starts on Sunday (in South Korea).

      Returns:
      Weekmodel
    • axis

      public static TimeAxis<KoreanCalendar.Unit,​KoreanCalendar> axis()

      Returns the associated time axis.

      Returns:
      chronology