Java Utility Library

Java GregorianCalendar - getCalendarType() Method



The java.util.GregorianCalendar.getCalendarType() method returns "gregory" as the calendar type.

Syntax

public String getCalendarType()

Parameters

No parameter is required.

Return Value

Returns "gregory" as the calendar type.

Exception

NA.

Example:

In the example below, the java.util.GregorianCalendar.getCalendarType() method returns "gregory" as the calendar type.

import java.util.*;

public class MyClass {
  public static void main(String[] args) {
    //creating a Calendar object with specified date
    GregorianCalendar Cal = new GregorianCalendar(2015, 10, 25);

    //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: Wed Nov 25 00:00:00 UTC 2015
Calendar Type: gregory

❮ Java.util - GregorianCalendar