@CalendarType(value="ethiopic") public final class EthiopianCalendar extends Calendrical<EthiopianCalendar.Unit,EthiopianCalendar> implements LocalizedPatternSupport
Represents the calendar used in Ethiopia.
It is built on the base of the Coptic calendar but uses two different eras. Another difference to Coptic calendar is the day starting in the morning at 06:00 (usual approximation for sunrise). For more details see Intro to the Ethiopic Calendar.
DAY_OF_WEEKDAY_OF_MONTHDAY_OF_YEARWEEKDAY_IN_MONTHMONTH_OF_YEARYEAR_OF_ERAERAEVANGELISTTABOTFurthermore, all elements defined in EpochDays and CommonElements are supported.
// printing to English
ChronoFormatter<EthiopianCalendar> formatter =
ChronoFormatter.setUp(EthiopianCalendar.axis(), Locale.ENGLISH)
.addPattern("EEE, d. MMMM yyyy", PatternType.CLDR_DATE).build();
PlainDate today = SystemClock.inLocalView().today();
EthiopianCalendar ethiopianDate = today.transform(EthiopianCalendar.class); // conversion at noon
System.out.println(formatter.format(ethiopianDate));
// parsing text in Amharic (requires Ethiopic unicode font for proper view in browser)
ChronoFormatter<EthiopianCalendar> formatter =
ChronoFormatter.setUp(EthiopianCalendar.class, new Locale("am"))
.addPattern("MMMM d ", PatternType.CLDR_DATE)
.startSection(Attributes.NUMBER_SYSTEM, NumberSystem.ETHIOPIC)
.addInteger(EthiopianCalendar.YEAR_OF_ERA, 1, 9)
.endSection()
.addLiteral(" (")
.addText(EthiopianCalendar.EVANGELIST)
.addPattern(") G", PatternType.CLDR_DATE)
.build();
String input = "ጥቅምት 11 ፲፱፻፺፯ (ማቴዎስ) ዓ/ም";
EthiopianCalendar ethio = formatter.parse(input);
System.out.println(ethio); // AMETE_MIHRET-1997-02-11
ZonalOffset offset = ZonalOffset.ofHours(OffsetSign.AHEAD_OF_UTC, 3);
ChronoFormatter<Moment> f =
ChronoFormatter.ofGenericMomentPattern("G, yyyy-MM-dd hh:mm a XXX", Locale.ENGLISH)
.withTimezone(offset)
.with(Locale.forLanguageTag("en-US-u-ca-ethiopic"));
assertThat(
f.parse("Amete Mihret, 2008-03-09 09:45 pm +03:00"),
is(PlainTimestamp.of(2015, 11, 19, 21, 45).at(offset)));
EthiopianEra,
EthiopianMonth,
EthiopianTime,
NumberSystem.ETHIOPIC,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
EthiopianCalendar.Unit
Defines some calendar units for the Ethiopian calendar.
|
| Modifier and Type | Field and Description |
|---|---|
static StdCalendarElement<Integer,EthiopianCalendar> |
DAY_OF_MONTH
Represents the Ethiopian day of month.
|
static StdCalendarElement<Weekday,EthiopianCalendar> |
DAY_OF_WEEK
Represents the Ethiopian day of week.
|
static StdCalendarElement<Integer,EthiopianCalendar> |
DAY_OF_YEAR
Represents the Ethiopian day of year.
|
static ChronoElement<EthiopianEra> |
ERA
Represents the Ethiopian era.
|
static ChronoElement<Evangelist> |
EVANGELIST
Represents the evangelist associated with a year of the Ethiopian leap year cycle.
|
static StdCalendarElement<EthiopianMonth,EthiopianCalendar> |
MONTH_OF_YEAR
Represents the Ethiopian month.
|
static TextElement<Tabot> |
TABOT
Represents the tabot name of the associated day-of-month.
|
static OrdinalWeekdayElement<EthiopianCalendar> |
WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
|
static StdCalendarElement<Integer,EthiopianCalendar> |
YEAR_OF_ERA
Represents the Ethiopian year.
|
| Modifier and Type | Method and Description |
|---|---|
GeneralTimestamp<EthiopianCalendar> |
at(EthiopianTime time)
Creates a new local timestamp with this date and given Ethiopian time.
|
static TimeAxis<EthiopianCalendar.Unit,EthiopianCalendar> |
axis()
Returns the associated time axis.
|
boolean |
equals(Object obj)
Based on the epoch day number and the calendar system.
|
int |
getDayOfMonth()
Yields the Ethiopian day of month.
|
Weekday |
getDayOfWeek()
Determines the day of week.
|
int |
getDayOfYear()
Yields the Ethiopian day of year.
|
static Weekmodel |
getDefaultWeekmodel()
Obtains the standard week model of this calendar.
|
EthiopianEra |
getEra()
Yields the Ethiopian era.
|
EthiopianMonth |
getMonth()
Yields the Ethiopian month.
|
int |
getYear()
Yields the Ethiopian year.
|
int |
hashCode()
Based on the epoch day number.
|
boolean |
isLeapYear()
Is the year of this date a leap year?
|
static boolean |
isValid(EthiopianEra 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 Ethiopian month in days.
|
int |
lengthOfYear()
Yields the length of current Ethiopian year in days.
|
static EthiopianCalendar |
nowInSystemTime()
Obtains the current calendar date in system time.
|
static EthiopianCalendar |
of(EthiopianEra era,
int yearOfEra,
EthiopianMonth month,
int dayOfMonth)
Creates a new instance of an Ethiopian calendar date.
|
static EthiopianCalendar |
of(EthiopianEra era,
int yearOfEra,
int month,
int dayOfMonth)
Creates a new instance of an Ethiopian 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<EthiopianEra> ERA
Represents the Ethiopian era.
A change of the era has no effect.
@FormattableElement(format="y") public static final StdCalendarElement<Integer,EthiopianCalendar> YEAR_OF_ERA
Represents the Ethiopian year.
Note: The format engine of Time4J uses the Ethiopic numeral system for calendar years by default if the language is Amharic.
NumberSystem.ETHIOPIC@FormattableElement(format="M", alt="L") public static final StdCalendarElement<EthiopianMonth,EthiopianCalendar> MONTH_OF_YEAR
Represents the Ethiopian month.
@FormattableElement(format="d") public static final StdCalendarElement<Integer,EthiopianCalendar> DAY_OF_MONTH
Represents the Ethiopian day of month.
@FormattableElement(format="D") public static final StdCalendarElement<Integer,EthiopianCalendar> DAY_OF_YEAR
Represents the Ethiopian day of year.
@FormattableElement(format="E") public static final StdCalendarElement<Weekday,EthiopianCalendar> DAY_OF_WEEK
Represents the Ethiopian day of week.
If the day-of-week is set to a new value then Time4J handles the Ethiopian calendar week as starting on Sunday (deviation from Coptic calendar).
@FormattableElement(format="F") public static final OrdinalWeekdayElement<EthiopianCalendar> WEEKDAY_IN_MONTH
Element with the ordinal day-of-week within given calendar month.
public static final ChronoElement<Evangelist> EVANGELIST
Represents the evangelist associated with a year of the Ethiopian leap year cycle.
The fourth evangelist (John) is always associated with a leap year.
public static final TextElement<Tabot> TABOT
Represents the tabot name of the associated day-of-month.
Example of usage in formatting:
ChronoFormatter<EthiopianCalendar> f =
ChronoFormatter.setUp(EthiopianCalendar.axis(), new Locale("am"))
.addPattern("d MMMM y G", PatternType.CLDR_DATE)
.addLiteral(" (")
.addText(EthiopianCalendar.TABOT)
.addLiteral(')')
.build();
String s = f.format(EthiopianCalendar.of(EthiopianEra.AMETE_MIHRET, 2007, 6, 25));
public static EthiopianCalendar of(EthiopianEra era, int yearOfEra, EthiopianMonth month, int dayOfMonth)
Creates a new instance of an Ethiopian calendar date.
era - Ethiopian erayearOfEra - Ethiopian year of era in the range 1-9999 (1-15499 if amete alem)month - Ethiopian monthdayOfMonth - Ethiopian day of month in the range 1-30EthiopianCalendarIllegalArgumentException - in case of any inconsistenciespublic static EthiopianCalendar of(EthiopianEra era, int yearOfEra, int month, int dayOfMonth)
Creates a new instance of an Ethiopian calendar date.
era - Ethiopian erayearOfEra - Ethiopian year of era in the range 1-9999 (1-15499 if amete alem)month - Ethiopian month in the range 1-13dayOfMonth - Ethiopian day of month in the range 1-30EthiopianCalendarIllegalArgumentException - in case of any inconsistenciespublic static EthiopianCalendar nowInSystemTime()
Obtains the current calendar date in system time.
Convenient short-cut for: SystemClock.inLocalView().now(EthiopianCalendar.axis()).
Attention: The Ethiopian calendar changes the date in the morning at 6 AM.
SystemClock.inLocalView(),
ZonalClock.now(net.time4j.engine.Chronology)public EthiopianEra getEra()
Yields the Ethiopian era.
If possible, the era EthiopianEra.AMETE_MIHRET will be preferred.
public int getYear()
Yields the Ethiopian year.
If possible, the year of era EthiopianEra.AMETE_MIHRET will be preferred.
public EthiopianMonth getMonth()
Yields the Ethiopian month.
public int getDayOfMonth()
Yields the Ethiopian day of month.
public Weekday getDayOfWeek()
Determines the day of week.
The Ethiopian calendar also uses a 7-day-week.
public int getDayOfYear()
Yields the Ethiopian day of year.
public int lengthOfMonth()
Yields the length of current Ethiopian month in days.
public int lengthOfYear()
Yields the length of current Ethiopian year in days.
public boolean isLeapYear()
Is the year of this date a leap year?
public static boolean isValid(EthiopianEra 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(EthiopianEra, int, int, int)public GeneralTimestamp<EthiopianCalendar> at(EthiopianTime time)
Creates a new local timestamp with this date and given Ethiopian time.
Note: The Ethiopian time will be automatically converted to ISO.
time - ethiopian time starting in the morningpublic 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<EthiopianCalendar.Unit,EthiopianCalendar>Chronology.getChronoType()public int hashCode()
CalendricalBased on the epoch day number.
hashCode in class Calendrical<EthiopianCalendar.Unit,EthiopianCalendar>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<EthiopianCalendar.Unit,EthiopianCalendar>public static Weekmodel getDefaultWeekmodel()
Obtains the standard week model of this calendar.
The Ethiopian calendar usually starts on Sunday.
public static TimeAxis<EthiopianCalendar.Unit,EthiopianCalendar> axis()
Returns the associated time axis.
Copyright © 2014–2021. All rights reserved.