Java Calendar - getCalendarType() Method
The java.util.Calendar.getCalendarType() method returns the calendar type of this Calendar. Calendar types are defined by the Unicode Locale Data Markup Language (LDML) specification.
Syntax
public String getCalendarType()
Parameters
No parameter is required.
Return Value
Returns the LDML-defined calendar type or the class name of this Calendar instance.
Exception
NA.
Example:
In the example below, the java.util.Calendar.getCalendarType() method returns the calendar type of the given Calendar.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating a Calendar object with specified date Calendar Cal = Calendar.getInstance(); //printing the Calendar System.out.println("The Calendar is: " + Cal.getTime()); //getting the calendar type System.out.println("Calendar Type: " + Cal.getCalendarType()); } }
The output of the above code will be:
The Calendar is: Sat May 08 10:37:59 UTC 2021 Calendar Type: gregory
❮ Java.util - Calendar