What is Period.getChronology() in Java?

getChronology() is an instance method of the Period which is used to retrieve the chronology of the Period object, i.e ISOInternational Organization for Standardization calendar system.

The Chronology represents the calendar system in use.

getChronology() method is defined in the Period class. The Period class is defined in the java.time package. To import the Period class, use the following import statement:

import java.time.Period;

Syntax


public IsoChronology getChronology()

Parameters

This method takes no parameters.

Return value

This method returns the ISO chronology.

Code

import java.time.Period;
public class Main{
public static void main(String[] args) {
int numMonths = 0;
int numYears = 0;
int numDays = 0;
Period period = Period.of(numYears, numMonths, numDays);
System.out.printf("Chronology(%s) = %s\n", period, period.getChronology());
}
}

Free Resources