Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

ChronoPeriod getChronology() method in Java with Examples

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The getChronology() method of ChronoPeriod interface in Java is used to get the chronology of this Period, which is the ISO calendar system.

Syntax:

ChronoPeriod getChronology()

Parameters: This method does not accepts any parameter.

Return Value: This method returns String representation of this

Below program illustrates the above method:

Program 1:




// Java code to show the getChronology() function
  
import java.time.*;
import java.time.chrono.*;
import java.time.temporal.ChronoUnit;
  
public class ChronoPeriodClass {
  
    // Function to negate given periods
    static void printChronology(ChronoPeriod p1)
    {
  
        System.out.println(p1.getChronology());
    }
  
    // Driver Code
    public static void main(String[] args)
    {
        // Defining period
        int year = 4;
        int months = 11;
        int days = 10;
        ChronoPeriod p1 = Period.of(year, months, days);
  
        printChronology(p1);
    }
}

Output:

ISO

Program 2:




// Java code to show the getChronology() function
  
import java.time.*;
import java.time.chrono.*;
import java.time.temporal.ChronoUnit;
  
public class ChronoPeriodClass {
  
    // Function to negate given periods
    static void printChronology(ChronoPeriod p1)
    {
  
        System.out.println(p1.getChronology());
    }
  
    // Driver Code
    public static void main(String[] args)
    {
        // Defining period
        int year = -4;
        int months = -11;
        int days = -10;
        ChronoPeriod p1 = Period.of(year, months, days);
  
        printChronology(p1);
    }
}

Output:

ISO

Reference: https://docs.oracle.com/javase/9/docs/api/java/time/chrono/ChronoPeriod.html#getChronology–


My Personal Notes arrow_drop_up
Last Updated : 24 Jun, 2019
Like Article
Save Article
Similar Reads
Related Tutorials