@CalendarType(value="coptic") public final class CopticCalendar extends Calendrical<CopticCalendar.Unit,CopticCalendar> implements LocalizedPatternSupport
Represents the calendar used by the Coptic church in Egypt.
It is a solar calendar which defines years consisting of 13 months. The first 12 months are always 30 days long. The last month has 5 or 6 days depending if a Coptic year is a leap year or not. The leap year rule is the same as defined in Julian Calendar, namely every fourth year. Years are counted since the era of martyrs where the Julian year AD 284 is counted as Coptic year 1. See also Wikipedia. According to the book "Calendrical calculations" of Dershowitz/Reingold, the Coptic day starts at sunset on the previous day. Time4J will also assume that despite of the fact that the ancient Egypt calendar (the historic ancestor of the Coptic calendar) started the day at sunrise. We assume here an adaptation of the Coptic calendar to the habits of Islamic calendar in Egypt.
Furthermore, all elements defined in EpochDays and CommonElements are supported.
ChronoFormatter<CopticCalendar> formatter =
ChronoFormatter.setUp(CopticCalendar.axis(), Locale.ENGLISH)
.addPattern("EEE, d. MMMM yyyy", PatternType.CLDR_DATE).build();
PlainDate today = SystemClock.inLocalView().today();
CopticCalendar copticDate = today.transform(CopticCalendar.class); // conversion at noon
System.out.println(formatter.format(copticDate));
Locale locale = Locale.forLanguageTag("en-u-ca-coptic");
ChronoFormatter<CalendarDate> f = ChronoFormatter.ofGenericCalendarStyle(DisplayMode.FULL, locale);
assertThat(
f.format(PlainDate.of(2017, 10, 1)),
is("Sunday, Tout 21, 1734 A.M."));
| Modifier and Type | Class and Description |
|---|---|
static class |
CopticCalendar.Unit
Defines some calendar units for the Coptic calendar.
|
| Modifier and Type | Field and Description |
|---|---|
static StdCalendarElement<Integer,CopticCalendar> |
DAY_OF_MONTH
Represents the Coptic day of month.
|
static StdCalendarElement<Weekday,CopticCalendar> |
DAY_OF_WEEK
Represents the Coptic day of week.
|
static StdCalendarElement<Integer,CopticCalendar> |
DAY_OF_YEAR
Represents the Coptic day of year.
|
static ChronoElement<CopticEra> |
ERA
Represents the Coptic era.
|
static StdCalendarElement<CopticMonth,CopticCalendar> |
MONTH_OF_YEAR
Represents the Coptic month.
|
static OrdinalWeekdayElement<CopticCalendar> |
WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
|
static StdCalendarElement<Integer,CopticCalendar> |
YEAR_OF_ERA
Represents the Coptic year.
|
| Modifier and Type | Method and Description |
|---|---|
GeneralTimestamp<CopticCalendar> |
at(PlainTime time)
Creates a new local timestamp with this date and given wall time.
|
GeneralTimestamp<CopticCalendar> |
atTime(int hour,
int minute)
Is equivalent to
at(PlainTime.of(hour, minute)). |
static TimeAxis<CopticCalendar.Unit,CopticCalendar> |
axis()
Returns the associated time axis.
|
boolean |
equals(Object obj)
Based on the epoch day number and the calendar system.
|
int |
getDayOfMonth()
Yields the Coptic day of month.
|
Weekday |
getDayOfWeek()
Determines the day of week.
|
int |
getDayOfYear()
Yields the Coptic day of year.
|
static Weekmodel |
getDefaultWeekmodel()
Obtains the standard week model of this calendar.
|
CopticEra |
getEra()
Yields the Coptic era.
|
CopticMonth |
getMonth()
Yields the Coptic month.
|
int |
getYear()
Yields the Coptic year.
|
int |
hashCode()
Based on the epoch day number.
|
boolean |
isLeapYear()
Is the year of this date a leap year?
|
static boolean |
isValid(int yearOfEra,
int month,
int dayOfMonth)
Queries if given parameter values form a well defined calendar date.
|
int |
lengthOfMonth()
Yields the length of current Coptic month in days.
|
int |
lengthOfYear()
Yields the length of current Coptic year in days.
|
static CopticCalendar |
nowInSystemTime()
Obtains the current calendar date in system time.
|
static CopticCalendar |
of(int cyear,
CopticMonth cmonth,
int cdom)
Creates a new instance of a Coptic calendar date.
|
static CopticCalendar |
of(int cyear,
int cmonth,
int cdom)
Creates a new instance of a Coptic 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<CopticEra> ERA
Represents the Coptic era.
@FormattableElement(format="y") public static final StdCalendarElement<Integer,CopticCalendar> YEAR_OF_ERA
Represents the Coptic year.
@FormattableElement(format="M", alt="L") public static final StdCalendarElement<CopticMonth,CopticCalendar> MONTH_OF_YEAR
Represents the Coptic month.
@FormattableElement(format="d") public static final StdCalendarElement<Integer,CopticCalendar> DAY_OF_MONTH
Represents the Coptic day of month.
@FormattableElement(format="D") public static final StdCalendarElement<Integer,CopticCalendar> DAY_OF_YEAR
Represents the Coptic day of year.
@FormattableElement(format="E") public static final StdCalendarElement<Weekday,CopticCalendar> DAY_OF_WEEK
Represents the Coptic day of week.
If the day-of-week is set to a new value then Time4J handles the Coptic calendar week as starting on Saturday (like in Egypt).
@FormattableElement(format="F") public static final OrdinalWeekdayElement<CopticCalendar> WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
public static CopticCalendar of(int cyear, CopticMonth cmonth, int cdom)
Creates a new instance of a Coptic calendar date.
cyear - Coptic year in the range 1-9999cmonth - Coptic monthcdom - Coptic day of month in range 1-30CopticCalendarIllegalArgumentException - in case of any inconsistenciespublic static CopticCalendar of(int cyear, int cmonth, int cdom)
Creates a new instance of a Coptic calendar date.
cyear - Coptic year in the range 1-9999cmonth - Coptic monthin range 1-13cdom - Coptic day of month in range 1-30CopticCalendarIllegalArgumentException - in case of any inconsistenciespublic static CopticCalendar nowInSystemTime()
Obtains the current calendar date in system time.
Convenient short-cut for: SystemClock.inLocalView().now(CopticCalendar.axis()).
Attention: The Coptic calendar changes the date in the evening at 6 PM.
SystemClock.inLocalView(),
ZonalClock.now(net.time4j.engine.Chronology)public CopticEra getEra()
Yields the Coptic era.
CopticEra.ANNO_MARTYRUMpublic int getYear()
Yields the Coptic year.
public CopticMonth getMonth()
Yields the Coptic month.
public int getDayOfMonth()
Yields the Coptic day of month.
public Weekday getDayOfWeek()
Determines the day of week.
The Coptic calendar also uses a 7-day-week.
public int getDayOfYear()
Yields the Coptic day of year.
public int lengthOfMonth()
Yields the length of current Coptic month in days.
public int lengthOfYear()
Yields the length of current Coptic year in days.
public boolean isLeapYear()
Is the year of this date a leap year?
public static boolean isValid(int yearOfEra,
int month,
int dayOfMonth)
Queries if given parameter values form a well defined calendar date.
yearOfEra - the year of era to be checkedmonth - the month to be checkeddayOfMonth - the day of month to be checkedtrue if valid else falseof(int, int, int)public GeneralTimestamp<CopticCalendar> 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<CopticCalendar> 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<CopticCalendar.Unit,CopticCalendar>Chronology.getChronoType()public int hashCode()
CalendricalBased on the epoch day number.
hashCode in class Calendrical<CopticCalendar.Unit,CopticCalendar>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<CopticCalendar.Unit,CopticCalendar>public static Weekmodel getDefaultWeekmodel()
Obtains the standard week model of this calendar.
The Coptic calendar usually starts on Saturday.
public static TimeAxis<CopticCalendar.Unit,CopticCalendar> axis()
Returns the associated time axis.
Copyright © 2014–2021. All rights reserved.