Current date and time in Ethiopia, UI, code, and API

I previously wrote about a page that shows the current date and time in Ethiopia. It’s good to see people using it. Someone was kind enough to comment recently that it was broken. Either I didn’t implement the algorithm correctly or maybe the algorithm itself is erroneous. Date calculations can get really complex. So it was easier to write it from scratch.

To see it working

To see current Ethiopian date go here: http://time.ertale.com

Code

PHP code: http://github.com/tilaye/ethiopiandate
Example use: http://time.ertale.com

API

Feel free to use my backend if you want to do conversions. You can pass any time on, or after January 1, 1970 and the year 2099. Here is an example:

Gregorian Date to convert in GMT: February 7, 2015 16:09:12
Corresponding Unix time: 1423325352
Conversion URL: http://time.ertale.com/time.php?t=1423325352
Result returned is: 2007-5-30-1-09-12-3-6

The result is in the format year-month-day-hour-minute-seconds-timeofday-weekofday where,

year is the Ethiopian year
month is the Ethiopian month, between 1 to 13
day is the Ethiopian day, between 1 and 30
hour  is the Ethiopian hour, the way Ethiopians count time. Here is what you will get,

  • Midnight – 6
  • 6 AM in the morning – 12
  • 7 AM in the morning – 1
  • Noon – 6
  • 6 PM in the evening – 12
  • 7 PM in the evening – 1

You can tell between Ethiopian day and night using the timeofday number (see below).

minute and second are the Ethiopian minute and second. No conversion is done there.
timeofday runs from 0 to 3 corresponding to Lelit ለሊት, Tewat ጠዋት, Keseat ከሰዓት and Misht ምሽት.

  • 0 – ለሊት 6:00 – 11:59
  • 1 – ጠዋት 12:00 – 5:59
  • 2 – ከሰዓት 6:00 – 11:59
  • 3 - ምሽት 12:00 – 5:59

weekofday runs between 1 and 7, where 1 stands for Monday

Hope that helps. Keep the feedback coming!

7 thoughts on “Current date and time in Ethiopia, UI, code, and API

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>