There is a constant in the Calendar
class called: UNDECIMBER
. It describes the 13th month.
Is there a useful purpose for this constant? In Wikipedia it is written that it is for the lunar calendar. But there is no implementation for such calendar.
And does there exist any solutions for the 14th month (Duodecimber)?
I didn't found so much in the web, and I would like to find out more about this topic.
As already said, some lunar (and other ancient) calendars have 13 months. One example is the Coptic Calendar.
Although there are no implementations of calendars with 13 months that extends
java.util.Calendar
, in Java 8's new API there are some. With the introduction of the new java.time API, it was also created the ThreeTen Extra project, which contains an implementation for that.The class is
org.threeten.extra.chrono.CopticChronology
, which extends the nativejava.time.chrono.Chronology
. I've just made a sample code to create a date in this calendar and loop through its months:The output is:
Note that the year changed just after the 13th month.
The ThreeTen Extra project also has an implementation for the Ethiopian calendar, which has 13 months as well.
And, as an example of a calendar with 14 months, there's the
PaxChronology
class, which implements the Pax Calendar: a proposed reform calendar system, but not currently in use, as far as I know.Quoting wikipedia:
And according to javadoc:
Example:
Output:
You can notice that the year changes after the 14th month. The range is
1 - 13/14
because years can have 13 or 14 months, depending if it's a leap year or not.The
Calendar.UNDECIMBER
is an additional constant in the Calendar class that is not typically used in the widely used Gregorian Calendar but certain Lunar calendars use a 13th month. That's the purpose of this field.Refer to the Java Docs below:
https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#UNDECIMBER
Wikipedia article for this:
https://en.wikipedia.org/wiki/Undecimber
There is also a mention of a 14th month - Duodecimber in the wiki. Unfortunately, Java does not (yet) support that.
Hope this helps!