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






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.