Home »
Java programming language
Java GregorianCalendar getGregorianChange() Method with Example
GregorianCalendar Class getGregorianChange() method: Here, we are going to learn about the getGregorianChange() method of GregorianCalendar Class with its syntax and example.
Submitted by Preeti Jain, on February 15, 2020
GregorianCalendar Class getGregorianChange() method
- getGregorianChange() method is available in java.util package.
- getGregorianChange() method is used to return the gregorian change date from julian date to gregorian date.
- getGregorianChange() method is a non-static method, it is accessible with class object only and if we try to access the method with class name then we will get an error.
- getGregorianChange() method does not throw an exception at the time of getting gregorian change date.
Syntax:
public final Date getGregorianChange();
Parameter(s):
- It does not accept any parameter.
Return value:
The return type of this method is Date, it returns gregorian change date from this GregorianCalendar instance.
Example:
// Java program to demonstrate the example
// of Date getGregorianChange() method of
// GregorianCalendar
import java.util.*;
public class GetGregorianChange {
public static void main(String[] args) {
// Instantiates a GregorianCalendar object
GregorianCalendar ca = (GregorianCalendar) GregorianCalendar.getInstance();
// Display current GregorianCalendar
System.out.println("ca: " + ca.getTime());
// By using getGregorianChange() method isto
// change the gregorian calendar date
System.out.print("ca.getGregorianChange(): ");
System.out.println(ca.getGregorianChange());
}
}
Output
ca: Sat Feb 15 09:21:00 GMT 2020
ca.getGregorianChange(): Fri Oct 15 00:00:00 GMT 1582