IsoChronology eras() method in Java with Example Last Updated : 24 Jan, 2023 Comments Improve Suggest changes Like Article Like Report The eras() method of java.time.chrono.IsoChronology class is used to retrieve all the eras comes under this particular Iso chronology. Syntax: public List eras() Parameter: This method does not accept any argument as a parameter. Return Value: This method returns all the eras comes under this particular Iso chronology. Below are the examples to illustrate the eras() method: Example 1: Java // Java program to demonstrate // eras() method import java.util.*; import java.io.*; import java.time.*; import java.time.chrono.*; public class GFG { public static void main(String[] argv) { try { // creating and initializing // LocalDate Object LocalDate hidate = LocalDate.now(); // getting IsoChronology // used in LocalDate IsoChronology crono = hidate.getChronology(); // getting all IsoEras present // by using eras() method List<Era> list = crono.eras(); // display the result System.out.println("IsoEra is: " + (list.iterator()).next()); } catch (DateTimeException e) { System.out.println("IsoEra is invalid"); System.out.println("Exception thrown: " + e); } } } Output:IsoEra is: BCE Example 2: Java // Java program to demonstrate // eras() method import java.util.*; import java.io.*; import java.time.*; import java.time.chrono.*; public class GFG { public static void main(String[] argv) { try { // creating and initializing // LocalDate Object LocalDate hidate = LocalDate.now(); // getting IsoChronology // used in LocalDate IsoChronology crono = hidate.getChronology(); // getting all IsoEras present // by using eras() method List<Era> list = crono.eras(); // getting list Iterator Iterator iter = list.iterator(); // display the result System.out.println("List of IsoEra : " + "\n" + iter.next() + "\n" + iter.next()); } catch (DateTimeException e) { System.out.println("IsoEra is invalid"); System.out.println("Exception thrown: " + e); } } } Output:List of IsoEra : BCE CE Reference: https://docs.oracle.com/javase/9/docs/api/java/time/chrono/IsoChronology.html#eras-- Comment More infoAdvertise with us Next Article JapaneseChronology eraOf() method in Java with Example R rohitprasad3 Follow Improve Article Tags : Java Java-Functions Java-Time-Chrono package Practice Tags : Java Similar Reads IsoChronology eraOf() method in Java with Example The eraOf() method of java.time.chrono.IsoChronology class is used to retrieve the Iso Era by using numeric value 0 and 1 because IsoChronology contains only two HijrahEra. Syntax: public IsoEra eraOf(int eraValue) Parameter: This method takes the eraValue integer as a parameter for which IsoEra is 2 min read JapaneseChronology eras() method in Java with Example The eras() method of java.time.chrono.JapaneseChronology class is used to retrieve all the eras comes under this particular Japanese chronology. Syntax: public List eras() Parameter: This method does not accept any argument as a parameter. Return Value: This method returns all the eras comes under t 2 min read JapaneseChronology eraOf() method in Java with Example The eraOf() method of java.time.chrono.JapaneseChronology class is used to retrieve the JapaneseEra by using numeric value. Syntax: public JapaneseEra eraOf(int eraValue) Parameter: This method takes the eraValue integer as a parameter for which JapaneseEra is going to be generated. Return Value: Th 2 min read IsoChronology getId() method in Java with Example The getId() method of java.time.chrono.IsoChronology class is used to retrieve the identification status for the particular chronology for which getId() method is revoked. Syntax: public String getId() Parameter: This method does not accept any argument as a parameter. Return Value: This method retu 2 min read IsoChronology range() method in Java with Example The range() method of java.time.chrono.IsoChronology class is used to get the range of from the specified field of type ChronoField. Syntax: public ValueRange range(ChronoField field) Parameter: This method takes the field of type ChronoField as a parameter. Return Value: This method returns range o 2 min read IsoChronology dateEpochDay() method in Java with Example The dateEpochDay() method of java.time.chrono.IsoChronology class is used to get the local date according to ISO system from Epoch Day.Syntax: public IsoDate dateEpochDay(long epochDay) Parameter: This method takes the epochDay of type long as a parameter.Return Value: This method returns the IsoDat 2 min read Like