Date Conversion Utility Module
Documentation
Overview
The DateConverter class is a utility for handling Gregorian Calendar (GC) to Ethiopian
Calendar (EC) conversions within the Vaccine Management System (VMS).
It ensures that the system can present dates in the local Ethiopian calendar format, which is
essential for healthcare providers and patients who primarily use the Ethiopian calendar system.
This class currently supports:
Getting today’s Ethiopian calendar date.
Converting any Gregorian date (year, month, day) into Ethiopian calendar format.
Class Structure
Class Declaration
public class DateConverter
Standalone utility class (no inheritance).
Contains static methods only for easy use without instantiation.
Key Methods
1. getTodayInEC()
public static String getTodayInEC()
Purpose: Returns today’s date in the Ethiopian Calendar, formatted as dd/MM/yyyy.
Process:
o Retrieves today’s Gregorian date (LocalDate.now()).
o Converts it to Ethiopian date using the conversion algorithm.
o Formats it as a string.
Return: A String in dd/MM/yyyy Ethiopian calendar format.
Example:
String todayEC = DateConverter.getTodayInEC();
System.out.println(todayEC); // e.g., "14/12/2017"
2. toEthiopian(int gcYear, int gcMonth, int gcDay)
private static int[] toEthiopian(int gcYear, int gcMonth, int gcDay)
Purpose: Converts a given Gregorian date into Ethiopian calendar format.
Parameters:
o gcYear: Gregorian year
o gcMonth: Gregorian month (1–12)
o gcDay: Gregorian day (1–31)
Return: int[] {year, month, day} in Ethiopian calendar.
Usage: Internal helper method used by getTodayInEC().
3. gregorianToJulian(int year, int month, int day)
private static int gregorianToJulian(int year, int month, int day)
Purpose: Converts a Gregorian date into a Julian Day Number (JDN).
Algorithm: Uses the astronomical formula for converting Gregorian calendar dates into
Julian Day Numbers.
Return: Integer Julian Day Number.
Role: Intermediate step for conversion into Ethiopian calendar.
4. julianToEthiopian(int jd)
private static int[] julianToEthiopian(int jd)
Purpose: Converts a Julian Day Number (JDN) into an Ethiopian calendar date.
Return: int[] {year, month, day} in Ethiopian calendar.
Algorithm Notes:
o Accounts for the Ethiopian leap year cycle (4 years, with 13th month
adjustment).
o Corrects for edge cases around leap years.
Data Handling
Input: Gregorian calendar date (year, month, day).
Processing:
1. Convert Gregorian date → Julian Day Number.
2. Convert Julian Day Number → Ethiopian calendar date.
Output: Ethiopian calendar date (formatted dd/MM/yyyy string or {year, month, day}
array).
Example Usage
Get Today’s Ethiopian Date
String todayEC = DateConverter.getTodayInEC();
System.out.println("Today in Ethiopian Calendar: " + todayEC);
Convert a Specific Date
// Convert 1st August 2025 (Gregorian) → Ethiopian calendar
int[] ecDate = DateConverter.toEthiopian(2025, 8, 1);
System.out.printf("EC: %02d/%02d/%04d%n", ecDate[2], ecDate[1], ecDate[0]);
// Output: EC: 25/11/2017
Integration with VMS
Used in AppointmentManager to display appointment dates in both Gregorian and
Ethiopian calendars.
Useful in:
o Appointment scheduling
o Completion tracking
o Reporting/statistics in the Ethiopian calendar system
Dependencies
Java Time API (java.time.LocalDate)
No external libraries required
Error Handling & Limitations
Assumes input Gregorian dates are valid.
Ethiopian calendar leap year handling is implemented (Pagumē adjustment).
Currently does not support reverse conversion (EC → GC).
✅ With this utility, all date-sensitive operations in the Vaccine Management System can
seamlessly support both Gregorian and Ethiopian calendars.
Would you like me to also extend this documentation with a reverse conversion (EC → GC)
section (so appointments entered in EC can be stored in GC internally)?