Search in sources :

Example 1 with CopticCalendar

use of com.ibm.icu.util.CopticCalendar in project mycore by MyCoRe-Org.

the class MCRCalendar method getCalendarFromCopticDate.

/**
 * This method convert a CopticCalendar date to a CopticCalendar value. The
 * syntax for the coptic input is: <br>
 * <ul>
 * <li> [[[t]t.][m]m.][yyy]y [[A.|a.]M.]</li>
 * <li> y[yyy][-m[m][-t[t]]] [A.|a.]M.]</li>
 * </ul>
 *
 * @param date_string
 *            the date as string.
 * @param last
 *            the value is true if the date should be filled with the
 *            highest value of month or day like 12 or 30 else it fill the
 *            date with the lowest value 1 for month and day.
 *
 * @return the CopticCalendar date value or null if an error was occurred.
 * @exception MCRException if parsing has an error
 */
protected static CopticCalendar getCalendarFromCopticDate(String date_string, boolean last) {
    try {
        int[] fields = checkDateStringForCopticCalendar(date_string, last);
        CopticCalendar calendar = new CopticCalendar();
        calendar.set(fields[0], fields[1], fields[2]);
        return calendar;
    } catch (Exception e) {
        throw new MCRException("The ancient coptic calendar date is false.", e);
    }
}
Also used : CopticCalendar(com.ibm.icu.util.CopticCalendar)

Aggregations

CopticCalendar (com.ibm.icu.util.CopticCalendar)1