Ethiopian calendar year(DATE TYPE) are different from the Gregorian calendar year

Started by Lelisa Diribaabout 8 years ago3 messages
#1Lelisa Diriba
lelisa0404@gmail.com

In Ethiopia the year have 13 months and but in Gregorian calendar the year
have 12 months,
The Ethiopian society's are want to use his Ethiopian calendar year,i have
the algorithm,
but the way i add to the postgresql source code as EXTENSION? or to the
backend(to kernel)?
13th month have 5 days and in fourth year 13th month have 6 days.that means
1 year have 365.25 days,my algorithm converts Gregorian calendar year
to Ethiopian calendar year.

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Lelisa Diriba (#1)
Re: Ethiopian calendar year(DATE TYPE) are different from the Gregorian calendar year

Hi

2017-12-26 8:23 GMT+01:00 Lelisa Diriba <lelisa0404@gmail.com>:

In Ethiopia the year have 13 months and but in Gregorian calendar the year
have 12 months,
The Ethiopian society's are want to use his Ethiopian calendar year,i have
the algorithm,
but the way i add to the postgresql source code as EXTENSION? or to the
backend(to kernel)?
13th month have 5 days and in fourth year 13th month have 6 days.that
means 1 year have 365.25 days,my algorithm converts Gregorian calendar
year to Ethiopian calendar year.

It can be done via extension - you should to implement own date and
timestamp type with own input, output functions

Regards

Pavel

#3Hannu Krosing
hkrosing@gmail.com
In reply to: Lelisa Diriba (#1)
Re: Ethiopian calendar year(DATE TYPE) are different from the Gregorian calendar year

On 26.12.2017 09:23, Lelisa Diriba wrote:

In Ethiopia the year have 13 months and but in Gregorian calendar the
year have 12 months,
The Ethiopian society's are want to use his Ethiopian calendar year,i
have the algorithm,
but the way i add to the postgresql source code as EXTENSION? or to
the backend(to kernel)? 
13th month have 5 days and in fourth year 13th month have 6 days.that
means 1 year have 365.25 days,my algorithm converts  Gregorian
calendar year to Ethiopian calendar year.

You might want to check first, if the system locale support already
solves this for you.
If so, you may want to introduce this not as an extension, but as a locale

At least a cursory search shows that on some systems the locales do

There was some discussion on this

https://stackoverflow.com/questions/20001463/postgresql-ethiopian-date-format

and also at least Apple seems to have an Ethiopian calendar locale

https://developer.apple.com/documentation/foundation/nscalendar

--
Hannu Krosing
PostgreSQL Consultant
Performance, Scalability and High Availability
https://2ndquadrant.com/