Abushakir (ባሕረ ሃሳብ)

The words Bahire Hasab originate from the ancient language of Ge'ez, ( Arabic: Abu Shakir) is a time-tracking method, devised by the 12th pope of Alexandria, Pope St. Dimitri.

What does it mean?

"Bahire Hasab /'bəhrɛ həsəb'/ " simply means "An age with a descriptive and chronological number". In some books it can also be found as "Hasabe Bahir", in a sense giving time an analogy, resembling a sea.

This package allows developers to implement Ethiopian Calendar and Datetime System in their application(s)`.

This package is implemented using the UNIX EPOCH which means it's not a conversion of any other calendar system into Ethiopian, for instance, Gregorian Calendar.

Unix Epoch is measured using milliseconds since 01 Jan, 1970 UTC. In unix epoch leap seconds are ignored.

Prerequisites

Before you begin, ensure you have met the following requirements:

Getting started

In your library add the following import:

import com.github.besufikad17.abushakir.*;

How Does it work? The Bahirehasab Class

There are 8 Rules or you can call them conventions too. These are:

  1. When calculating [wenber]which is remainder of [ameteAlem] by 19, subtract 1 (ONE) from the remainder as of the story in ancient calculation "አንዱን ለዘመኑ ሰጠው".

  2. If [metkih] > 14, then month of [metkih] will be at the FIRST month of the year. which is መስከረም.

  3. If [metkih] <= 14, then month of [metkih] will be at the SECOND month of the year. which is ጥቅምት.

  4. If month of [metkih] is መስከረም (the FIRST month), then Nineveh or [nenewe] will be in ጥር (the FIFTH month).

  5. If month of [metkih] is ጥቅምት (the FIRST month), then Nineveh or [nenewe] will be in የካቲት (the SIXTH month).

  6. If the summation of [metkih] and the corresponding number of the weekday that [metkih] is on, is greater than 30 (> 30) then Nineveh or [nenewe] will be in የካቲት (the SIXTH month).

  7. If the value of [wenber] == 0, the corresponding value of the 30th weekday for መስከረም (the first month) will be the value of MEBAJA HAMER which is technically [metkih] + weekday corresponding value or number.

  8. If the value of [wenber] == 0, then Nineveh or [nenewe] will be in የካቲት (the SIXTH month)

The ETDateTime Class

ETDateTime can represent time values that are at a distance of at most 100,000,000 days from epoch (1970-01-01): -271821-04-20 to 275760-09-13. Create a ETDateTime object by using one of the constructors or by parsing a correctly formatted string, which complies with a subset of ISO 8601.ETDateTime can represent time values that are at a distance of at most 100,000,000 days from epoch (1970-01-01): -271821-04-20 to 275760-09-13.

The ETC class

The Ethiopian calendar is one of the the calendars which uses the solar system to reckon years, months and days, even time. Ethiopian single year consists of 365.25 days which will be 366 days with in 4 years period which causes the leap year. Ethiopian calendar has 13 months from which 12 months are full 30 days each and the 13th month will be 5 days or 6 days during leap year.

Getting current Time Details

To get the current time in the ethiopian calendar you first need to initialize the ETDateTime class and set it to now() method


    ETDateTime etDateTime = new ETDateTime();
    etDateTime = etDateTime.now();
    System.out.println(etDateTime.getDay()); // returns the day
    System.out.println(etDateTime.getMonth()); // returns month
    System.out.println(etDateTime.getYear()); // returns year

Other Availabe date info methods


    etDateTime.toString();
    etDateTime.getMinute();
    etDateTime.getSecond();
    etDateTime.getMillisecond();

Parsing Date from String

To parse a date from String you will need to initialize the ETDateTime clas with date as String

    ETDateTime etDateTime = ETDateTime.Parse("2012-07-07 15:12:17.500");
    System.out.println(etDateTime.getDay()); // returns the day 
    System.out.println(etDateTime.getMonth()); // returns month
    System.out.println(etDateTime.getYear()); // returns year

Parsing from milliseconds

Abushakir also supports parsing from unix milliseconds

    ETDateTime etDateTime = new ETDateTime().fromMillisecondsSinceEpoch(1585731446021L);
    System.out.println(etDateTime.getYear()); // returns year

Getting Evangalists

Getting the evangelist of the given year, if year is not provided it will take the current year and the years before christ ( አመተ ፍዳ ) and get the age of earth, since creation day of Adam and Eve and, divide it by 4.

    Bahirehasab bahirehasab = new Bahirehasab(2012);
    System.out.println(bahirehasab.getEvange());

Getting a date info in geez format

If you ever needed to return the date in geez numbers

        ETDateTime etDateTime = new ETDateTime(2012, 2, 10);
        System.out.println(etDateTime.getMonth()); // returns 2
        System.out.println(etDateTime.getMonthGeez()); // returns ጥቅምት
        System.out.println(etDateTime.getDay()); //returns 10
        System.out.println(etDateTime.getDayGeez()); // returns ፲

Date Comparision

Using Abushakir you can compare if a date is before or after a date

    ETDateTime etDateTime = new ETDateTime(2012, 2, 10);
    etDateTime.isAfter(new ETDateTime(2001)); //returns true
    etDateTime.isBefore(new ETDateTime(2001)); //returns false

Comparing Moments

    ETDateTime etd = new ETDateTime(2012, 2, 10);
    etd.isAtSameMomentAs(new ETDateTime(
                etd.getYear(),etd.getMonth(),etd.getDay(),
                etd.getHour(),etd.getMinute(),etd.getSecond(),
                etd.getMillisecond()
                )));

Operations on holidays

You Can also get the month and date for a given holiday or fasting season

    Bahirehasab b = new Bahirehasab();
    b.getSingleBealOrTsom("ዓቢይ ጾም").get("month"); //returns የካቲት
    b.getSingleBealOrTsom("ዓቢይ ጾም").get("date"); //returns 16

    b.getSingleBealOrTsom("ደብረ ዘይት").get("month")); //returns መጋቢት
    b.getSingleBealOrTsom("ደብረ ዘይት").get("date")); // returns 13

For further implementation example see this JavaFx application