Ethiopian (Ge'ez) calendar date functions for MariaDB — stored functions, a faster flattened variant, and a native C UDF
# Ethiopian Date Functions for MariaDB
Convert Gregorian dates to the Ethiopian (Ge'ez) calendar inside MariaDB —
12 months of 30 days plus ጳጉሜን (Pagume), a short 13th month of 5 days, or 6 in a
leap year.
```sql
SELECT ET_DATE('1896-03-01'), ET_MONTHNAME('1896-03-01'), ET_DAYNAME('1896-03-01');
-- 1888-06-23 የካቲት እሑድ
```
That is the Battle of Adwa — የካቲት 23, 1888 — and እሑድ, Sunday, which is the day
it was fought.
## Pick one of three
All three produce **identical results**. They differ only in speed and in how
much trouble they are to deploy.
| | What it is | Speed | Deploy cost |
| --- | --- | --- | --- |
| **1. Original** | 14 stored functions, copy-paste | baseline | paste one file |
| **2. Flattened** | same maths, no nested calls | **4.1× faster** | paste one file |
| **3. Native UDF** | C shared library | **105× faster** | needs root + a compiler |
**Start with 1.** Move to 2 if conversion shows up in a profile — it is a
drop-in paste with no downside. Reach for 3 only if you have measured that you
need it.
And read the speed section before choosing 3, because there is a
fourth option that beats all of them by three orders of magnitude and is plain
SQL: indexed generated columns.
### 1. Original — copy and paste
```sh
mariadb -u root -p your_database **One change from the original gist.**
> Its parameters were declared `(IN date DATE)`. The `IN` keyword in a
> *function* parameter list is MariaDB 10.8+ only — on 10.6 it is a syntax error
> and nothing loads. It is also redundant, since every stored-function parameter
> is `IN` by definition, so dropping it changes no behaviour and works from
> MariaDB 10.1 onward. CI caught this on the 10.6 matrix leg.
> The `DELIMITER $$` block needs a client that enables `CLIENT_MULTI_STATEMENTS`.
> The `mariadb`/`mysql` CLI does. Some drivers and migration tools do not — if
> the whole file comes back as a single syntax error, that is why; split it so
> each function ends with `END$$`.
### 2. Fl …