Skip to main content

ethioqen: Ethiopian Calendar, Time, and Unix Timestamp Conversion

Beta: the API is usable but still evolving. Expect breaking changes in minor releases. See CHANGELOG and the migration guide when upgrading.

PyPI version License CI Upload Python Package

ethioqen is a Python library that provides accurate and efficient conversions between the Ethiopian calendar, the Gregorian calendar, Ethiopian local time (12-hour format), standard 24-hour local time, and Unix timestamps.

Supports Python 3.10–3.14. See CHANGELOG for release notes.

Introduction

The Ethiopian calendar is a solar calendar used in Ethiopia and Eritrea. It differs significantly from the Gregorian calendar, which is the most widely used calendar system today.

Key Differences:

  • Year Offset: The Ethiopian calendar is typically 7-8 years behind the Gregorian calendar.
  • Months: It has 13 months: 12 months of 30 days each and a 13th month called Pagume, which has 5 days (6 days in a leap year).
  • New Year: The Ethiopian New Year (Enkutatash) falls on September 11th (or 12th in a Gregorian leap year).
  • Leap Years: Ethiopia follows a simple 4-year leap year cycle without the century exception found in the Gregorian calendar.

Ethiopian Local Time:

Ethiopian time uses a 12-hour clock that starts counting from dawn (around 6:00 AM standard time). This creates a 6-hour offset between Ethiopian and standard time:

  • 12:00 AM Ethiopian = 6:00 AM standard time
  • 1:00 AM Ethiopian = 7:00 AM standard time
  • 12:00 PM Ethiopian = 6:00 PM standard time
  • 6:00 PM Ethiopian = 12:00 AM standard time (next day)

Installation

pip install ethioqen

Development Setup

Requires Python 3.10+ and uv.

uv sync --all-groups

Usage Examples

Calendar Conversions

from ethioqen import (
    convert_ethiopian_to_gregorian,
    convert_gregorian_to_ethiopian,
)

# Convert from Ethiopian to Gregorian
greg_year, greg_month, greg_day = convert_ethiopian_to_gregorian(2016, 7, 6)
print(f"{greg_year}-{greg_month}-{greg_day}")  # Output: 2024-3-15

# Convert from Gregorian to Ethiopian
eth_year, eth_month, eth_day = convert_gregorian_to_ethiopian(2024, 3, 15)
print(f"{eth_year}-{eth_month}-{eth_day}")  # Output: 2016-7-6

Time Conversions

from ethioqen import (
    convert_to_ethiopian_time,
    convert_from_ethiopian_time,
)

# Convert standard time (14:30 / 2:30 PM) to Ethiopian time
eth_hour, eth_minute, is_pm = convert_to_ethiopian_time(14, 30)
print(f"{eth_hour}:{eth_minute} {'PM' if is_pm else 'AM'}")  # Output: 8:30 AM

# Convert Ethiopian time (8:30 AM) to standard time
std_hour, std_minute = convert_from_ethiopian_time(8, 30, is_pm=False)
print(f"{std_hour:02d}:{std_minute:02d}")  # Output: 14:30

Unix Timestamp Conversions

from ethioqen import ethiopian_to_unix, unix_to_ethiopian

# Convert Ethiopian date/time to Unix timestamp (UTC)
# 1:30 PM Ethiopian time
timestamp = ethiopian_to_unix(2016, 7, 6, eth_hour=1, minute=30, is_pm=True)
print(timestamp)  # Output: Unix timestamp

# Convert Unix timestamp to Ethiopian date/time (UTC)
eth_year, eth_month, eth_day, hour, minute, second, is_pm = unix_to_ethiopian(timestamp)
print(f"{eth_year}-{eth_month}-{eth_day} {hour}:{minute:02d} {'PM' if is_pm else 'AM'}")
# Output: 2016-7-6 1:30 PM

Timezone Support

from ethioqen import ethiopian_to_unix, unix_to_ethiopian

# Convert with timezone offset (UTC+3 for Ethiopia)
# 8:30 AM Ethiopian time
timestamp = ethiopian_to_unix(
    2016, 7, 6, eth_hour=8, minute=30, is_pm=False, tz_offset=3
)
print(timestamp)  # Output: Unix timestamp adjusted for UTC+3

# Convert back with timezone offset
eth_date = unix_to_ethiopian(timestamp, tz_offset=3)
print(
    f"{eth_date[0]}-{eth_date[1]}-{eth_date[2]} {eth_date[3]}:{eth_date[4]:02d} {'PM' if eth_date[6] else 'AM'}"
)
# Output: Ethiopian date/time in UTC+3

Contributing

We welcome contributions! Here's how you can help:

  1. Report Bugs

  2. Submit Pull Requests

    • Fork the repository
    • Create a new branch for your feature (git checkout -b feature/amazing-feature)
    • Make your changes
    • Write or update tests as needed
    • Update documentation if necessary
    • Submit a pull request
  3. Coding Style

    • Follow PEP 8 guidelines (enforced with ruff: uv run ruff check . and uv run ruff format --check .)
    • Include docstrings for new functions/classes
    • Add type hints where possible
  4. Testing

    • Run the test suite: uv run pytest
    • Add tests for new features
    • Ensure all tests pass before submitting (uv run ruff check . && uv run ruff format --check . && uv run pytest)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for ethioqen 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ethioqen 0.3.1
File Size Uploaded Provenance Actions
ethioqen-0.3.1.tar.gz 87.7 kB With provenance Details for ethioqen-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ethioqen 0.3.1
File Interpreter ABI Platform Actions
ethioqen-0.3.1-py3-none-any.whl Python 3 none any Details for ethioqen-0.3.1-py3-none-any.whl

Total release size: 97.8 kB

Release files / ethioqen-0.3.1.tar.gz

Download URL ethioqen-0.3.1.tar.gz
Size 87.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1016e7effa31386a6558d00da218095b1659cd49b90656fbcd69713af6b8b1c4
BLAKE2b-256 checksum
How to use checksums
77074ddedcd9ad675251396772da3f36742a5926d425a3232bed41f1f5ff8a07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / ethioqen-0.3.1-py3-none-any.whl

Download URL ethioqen-0.3.1-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c0851a35e325b7defeacca91bb5d139bb2f8ac256f9909e3f7a452e64630b3a
BLAKE2b-256 checksum
How to use checksums
e8ea935c4b86f8bdff106d602da4bd0443a66a8e94c213b6c403f9387eefef89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Security for ethioqen 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ethioqen-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page