Java LocalDate getChronology() Method with Examples

In this article we are going to see the use of Java LocalDate class getChronology()  method with suitable examples.

Java LocalDate getChronology() Method with Examples

Explanation:

This java.time.LocalDate.get(TemporalField field) method is used to get the chronology of the specified date, which is the ISO calendar system. This method does not take any parameter. It returns the ISO chronology.

Syntax:

public IsoChronology getChronology()

Let’s see a program to understand it more clearly.

Approach:

  • Create an objectof LocalDate class which will hold the parsed date.
  • Then use the getChronology() method for this particular date.
  • Print the final result.

Program:

import java.time.LocalDate;
public class Main
{
    public static void main(String[] args)
    {
        //create an object of LocalDate and pass the parse date into it
        //here it parses the local date
        LocalDate date = LocalDate.parse("2022-05-11");
        //print the result
      	System.out.println("Result: "+date.getChronology()); 
   	}
}

Output:

Result: ISO

The best and excellent way to learn a java programming language is by practicing Simple Java Program Examples as it includes basic to advanced levels of concepts.