Looking further down, the documentation you've linked has the same snippet repeated, only this time with a more detailed explanation, and it says:
Month, formatted the two digits with leading zeros as necessary, ie 01 - 13, where "01" is the first month of the year and ("13" is a special value required to support lunar calendars). >
Free translation:
Month, formatted with two digits with zero prefixed when needed. Ex: 01 to 13, where "01" is the first month of the year and ("13" is a special value required to support lunar calendars).
The name of the month in English is UNDECIMBER :
Value of the MONTH field indicating the thirteenth month of the year. Although GregorianCalendar does not use this value, lunar calendars do.
Free translation:
MONTH field value indicating the thirteenth month of the year. Although the GregorianCalendar does not use this value, lunar calendars use it.
(In) Fortunately, there is no standard Java class that supports the lunar calendar, but it is possible to find implementations made by lunatics like this here: hoveychen / lunar_calendar @ GitHub
When you try to use month 13 on a Gregorian calendar object, we get the first month of the next year. Example:
import java.util.Calendar;
public class Lunatico {
public static void main(String[] args) {
Calendar c1 = Calendar.getInstance();
c1.set(2015, Calendar.DECEMBER, 20); //data: 20/12/2015
Calendar c2 = Calendar.getInstance();
c2.set(2015, Calendar.UNDECIMBER, 20); //data: 20/13/2015
System.out.println(String.format("Dia normal: %1$te/%1$tm/%1$tY", c1));
System.out.println(String.format("Dia (quase) lunático: %1$te/%1$tm/%1$tY", c2));
System.out.println(String.format("\nMês: %1$tB", c2)); //escrevendo por extenso
}
}
Result:
Normal day: 12/20/2015
Day (almost) whimsical: 01/20/2016
Month: January
Notice that within String.format()
I used m
, as explained in the documentation.