@CalendarType(value="roc") public final class MinguoCalendar extends Calendrical<CalendarUnit,MinguoCalendar> implements LocalizedPatternSupport
The Minguo calendar used in Taiwan (Republic Of China) uses as only difference to western gregorian calendar a different year numbering with the Minguo era 1912-01-01.
See also: Wikipedia.
Furthermore, all elements defined in EpochDays and CommonElements are supported.
Locale locale = Locale.forLanguageTag("en-u-ca-roc");
ChronoFormatter<CalendarDate> f = ChronoFormatter.ofGenericCalendarStyle(DisplayMode.FULL, locale);
assertThat(
f.format(PlainDate.of(2017, 10, 1)),
is("Sunday, October 1, 106 Minguo"));
| Modifier and Type | Field and Description |
|---|---|
static StdCalendarElement<Integer,MinguoCalendar> |
DAY_OF_MONTH
Represents the day of month.
|
static StdCalendarElement<Weekday,MinguoCalendar> |
DAY_OF_WEEK
Represents the day of week.
|
static StdCalendarElement<Integer,MinguoCalendar> |
DAY_OF_YEAR
Represents the day of year.
|
static ChronoElement<MinguoEra> |
ERA
Represents the Minguo era which cannot be changed.
|
static StdCalendarElement<Month,MinguoCalendar> |
MONTH_OF_YEAR
Represents the month.
|
static OrdinalWeekdayElement<MinguoCalendar> |
WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
|
static StdCalendarElement<Integer,MinguoCalendar> |
YEAR_OF_ERA
Represents the Minguo year.
|
| Modifier and Type | Method and Description |
|---|---|
GeneralTimestamp<MinguoCalendar> |
at(PlainTime time)
Creates a new local timestamp with this date and given wall time.
|
GeneralTimestamp<MinguoCalendar> |
atTime(int hour,
int minute)
Is equivalent to
at(PlainTime.of(hour, minute)). |
static TimeAxis<CalendarUnit,MinguoCalendar> |
axis()
Returns the associated time axis.
|
boolean |
equals(Object obj)
Based on the epoch day number and the calendar system.
|
int |
getDayOfMonth()
Yields the day of month.
|
Weekday |
getDayOfWeek()
Determines the day of week.
|
int |
getDayOfYear()
Yields the day of year.
|
static Weekmodel |
getDefaultWeekmodel()
Obtains the standard week model of this calendar.
|
MinguoEra |
getEra()
Yields the Minguo era.
|
Month |
getMonth()
Yields the (gregorian) month.
|
int |
getYear()
Yields the Minguo year.
|
int |
hashCode()
Based on the epoch day number.
|
boolean |
isLeapYear()
Is the year of this date a leap year?
|
static boolean |
isValid(MinguoEra era,
int yearOfEra,
int month,
int dayOfMonth)
Queries if given parameter values form a well defined calendar date.
|
int |
lengthOfMonth()
Yields the length of current month in days.
|
int |
lengthOfYear()
Yields the length of current year in days.
|
static MinguoCalendar |
nowInSystemTime()
Obtains the current calendar date in system time.
|
static MinguoCalendar |
of(MinguoEra era,
int yearOfEra,
int month,
int dayOfMonth)
Creates a new instance of an Minguo calendar date.
|
static MinguoCalendar |
of(MinguoEra era,
int yearOfEra,
Month month,
int dayOfMonth)
Creates a new instance of a Minguo calendar date.
|
String |
toString()
Provides a complete textual representation of the state of
this time point.
|
compareTo, getDaysSinceEpochUTC, 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<MinguoEra> ERA
Represents the Minguo era which cannot be changed.
@FormattableElement(format="y") public static final StdCalendarElement<Integer,MinguoCalendar> YEAR_OF_ERA
Represents the Minguo year.
@FormattableElement(format="M", alt="L") public static final StdCalendarElement<Month,MinguoCalendar> MONTH_OF_YEAR
Represents the month.
@FormattableElement(format="d") public static final StdCalendarElement<Integer,MinguoCalendar> DAY_OF_MONTH
Represents the day of month.
@FormattableElement(format="D") public static final StdCalendarElement<Integer,MinguoCalendar> DAY_OF_YEAR
Represents the day of year.
@FormattableElement(format="E") public static final StdCalendarElement<Weekday,MinguoCalendar> DAY_OF_WEEK
Represents the day of week.
If the day-of-week is set to a new value then Time4J handles the calendar week as starting on Sunday.
@FormattableElement(format="F") public static final OrdinalWeekdayElement<MinguoCalendar> WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
public static MinguoCalendar of(MinguoEra era, int yearOfEra, Month month, int dayOfMonth)
Creates a new instance of a Minguo calendar date.
era - Minguo erayearOfEra - Minguo year of eramonth - gregorian monthdayOfMonth - day of monthMinguoCalendarIllegalArgumentException - in case of any inconsistenciespublic static MinguoCalendar of(MinguoEra era, int yearOfEra, int month, int dayOfMonth)
Creates a new instance of an Minguo calendar date.
era - Minguo erayearOfEra - Minguo year of eramonth - gregorian monthdayOfMonth - day of monthMinguoCalendarIllegalArgumentException - in case of any inconsistenciespublic static MinguoCalendar nowInSystemTime()
Obtains the current calendar date in system time.
Convenient short-cut for: SystemClock.inLocalView().now(MinguoCalendar.axis()).
SystemClock.inLocalView(),
ZonalClock.now(net.time4j.engine.Chronology)public MinguoEra getEra()
Yields the Minguo era.
public int getYear()
Yields the Minguo year.
public Month getMonth()
Yields the (gregorian) month.
public int getDayOfMonth()
Yields the day of month.
public Weekday getDayOfWeek()
Determines the day of week.
public int getDayOfYear()
Yields the day of year.
public int lengthOfMonth()
Yields the length of current month in days.
public int lengthOfYear()
Yields the length of current year in days.
public boolean isLeapYear()
Is the year of this date a leap year?
public static boolean isValid(MinguoEra era, int yearOfEra, int month, int dayOfMonth)
Queries if given parameter values form a well defined calendar date.
era - the era to be checkedyearOfEra - the year of era to be checkedmonth - the month to be checkeddayOfMonth - the day of month to be checkedtrue if valid else falseof(MinguoEra, int, int, int)public GeneralTimestamp<MinguoCalendar> at(PlainTime time)
Creates a new local timestamp with this date and given wall time.
If the time T24:00 is used
then the resulting timestamp will automatically be normalized such
that the timestamp will contain the following day instead.
time - wall timepublic GeneralTimestamp<MinguoCalendar> atTime(int hour, int minute)
Is equivalent to at(PlainTime.of(hour, minute)).
hour - hour of day in range (0-24)minute - minute of hour in range (0-59)IllegalArgumentException - if any argument is out of rangepublic boolean equals(Object obj)
CalendricalBased on the epoch day number and the calendar system.
In other words: Two date object are equal if they have the same temporal position on the local timeline and have the same calendrical type. Subclasses which define further state attributes must override this method.
If an only temporal comparison is required then the method
Calendrical.isSimultaneous(CalendarDate) is to be used.
equals in class Calendrical<CalendarUnit,MinguoCalendar>Chronology.getChronoType()public int hashCode()
CalendricalBased on the epoch day number.
hashCode in class Calendrical<CalendarUnit,MinguoCalendar>public String toString()
TimePointProvides a complete textual representation of the state of this time point.
The textual description often follows the conventions of ISO-8601. Usually the description starts with the chronological informations which are coarse-grained and ends with those ones which are fine-grained (for example the ISO-notation YYYY-MM-DD).
toString in class TimePoint<CalendarUnit,MinguoCalendar>public static Weekmodel getDefaultWeekmodel()
Obtains the standard week model of this calendar.
The Minguo calendar usually starts on Sunday.
public static TimeAxis<CalendarUnit,MinguoCalendar> axis()
Returns the associated time axis.
Copyright © 2014–2021. All rights reserved.