I am developing an Android app for an Ethiopian company and have to deal with dates.
The calendar used in Ethiopia is similar to the Gregorian one but has two main differences: it's set approx. 7 years earlier and has 13 months. At the time I post this question the date is 13-09-2021 in the Gregorian calendar and 03-01-2014 in the Ethiopian one.
My questions are:
does Android support the Ethiopian calendar and is it customary for people in Ethiopia to have their devices use it?
if so, do I have to get the default formatter (that uses the default calendar: Calendar.getInstance()
) in order to format the date properly?
instead, if the device uses the Gregorian calendar how does Java support the translation to the Ethiopian date?
What would you suggest in order to simulate the full scenario, with the device set with the proper current Ethiopian date (as if coming from the network provider) and locale?
While I know nothing about these calendaring systems, perhaps…
Add the ThreeTen-Extra library to your project to access the EthiopicChronology
class that plugs into the java.time framework bundled with Android.
This chronology defines the rules of the Ethiopic calendar system. This calendar system is primarily used in Ethiopia. Dates are aligned such that 0001-01-01 (Ethiopic) is 0284-08-29 (ISO).
You can also find a CopticChronology
class there too.
The Ethiopian calendar is rather a local calendar with some popularity in Ethiopia itself. And yes, there is even a special time keeping mode in this country starting the day at 6 am. However, I am not sure if the calendar is also wide-spread on mobile phones due to lack of sufficient support in the common operating systems like Android, IOS or Windows. Outside of Ethiopia, it is probably only relevant for religous minded Ethiopian people in the diaspora.
You can find some support presented by the class EthiopicCalendar delivered by IBM. I strongly assume that Amharic numbers are supported (but am not completely sure). I am less confident about the support for 6 am as start of the day and counting as zero (relevant if you ask for the current date). IBM says (similar but not identical to the standard usage of Calendar.getInstance()
):
EthiopicCalendar usually should be instantiated using Calendar.getInstance(ULocale) passing in a ULocale with the tag "@calendar=ethiopic".
The API of IBM offers a translation to the gregorian calendar and vice versa via the counted milliseconds since 1970-01-01T00:00Z. For formatting or parsing, use the dedicated formatter engine of IBM. Attention, it is not the standard formatting engine of Android. Of course, you have still to worry with strange features like counting the first month as number zero (instead of one).
My library Time4A is also written for Android and is a sister project of the main lib Time4J. Both libs contain the classes EthiopianCalendar and EthiopianTime. You will find some code examples in the javadoc. Support for non-decimal Amharic numbers exists, too. These classes require a special formatting engine, too, called ChronoFormatter. Like in case of IBM, Ethiopian month names like Meskerem
(even in Amharic or other languages) are well supported.
A transformation to the gregorian calendar (and vice versa) can be obtained by the expression ethiopianDate.transform(PlainDate.axis())
where the parameter denotes the target calendar (here, PlainDate
is the gregorian type).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With