LocalDate getEra() method in Java with Examples Last Updated : 28 Nov, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The getEra() method of LocalDate class in Java gets the era applicable at this date. Syntax: public Era getEra() Parameter: This method does not accepts any parameter. Return Value: The function returns the IsoChronology era constant applicable at this date and not null. Below programs illustrate the getEra() method of LocalDate in Java: Program 1: Java // Program to illustrate the getEra() method import java.util.*; import java.time.*; public class GfG { public static void main(String[] args) { // Parses the date LocalDate dt = LocalDate.parse("2018-11-27"); // Prints the day number System.out.println(dt.getEra()); } } Output: CE Program 2: Java // Program to illustrate the getEra() method import java.util.*; import java.time.*; public class GfG { public static void main(String[] args) { // Parses the date LocalDate dt = LocalDate.parse("2018-01-21"); // Prints the day number System.out.println(dt.getEra()); } } Output: CE Reference: https://docs.oracle.com/javase/10/docs/api/java/time/LocalDate.html#getEra() Comment More infoAdvertise with us Next Article LocalDate getYear() method in Java with Examples G gopaldave Follow Improve Article Tags : Java Java-Functions Java-time package Java-LocalDate Practice Tags : Java Similar Reads LocalDate getYear() method in Java with Examples The getYear() method of LocalDate class in Java gets the year field. Syntax: public int getYear() Parameter: This method does not accepts any parameter. Return Value: The function returns the year, from MIN_YEAR to MAX_YEAR Below programs illustrate the getYear() method of LocalDate in Java: Program 1 min read LocalDateTime getYear() method in Java with Examples The getYear() method of an LocalDateTime class is used to return the year field.This method returns the primitive int value for the year from MIN_YEAR to MAX_YEAR. Syntax: public int getYear() Parameter: This method does not accept any parameter. Returns: This method returns an integer value which i 1 min read LocalTime get() method in Java with Examples The get() method of a LocalTime class helps to get the value for the specified field passed as a parameter from this LocalTime as an integer value. This method queries this time for the value of the field and the returned value will always be within the valid range of values for the field. When the 2 min read Locale getVariant() Method in Java with Examples The getVariant() method of Locale class in Java is used to get a variant code for the specified locale. It returns an empty string if nothing is specified Syntax: LOCALE.getLanguage() Parameters: This method does not take any parameters. Return Value: This method either returns an empty string or th 1 min read LocalDate getMonthValue() method in Java with Examples The getMonthValue() method of LocalDate class in Java gets the month-of-year field from 1 to 12. Syntax: public int getMonthValue() Parameter: This method does not accepts any parameter. Return Value: The function returns the month of the year from 1-12 in numbers. Below programs illustrate the getM 1 min read LocalDateTime getSecond() method in Java with Examples The getSecond() method of an LocalDateTime class is used to return the second-of-minute field. This method returns an integer value ranging from 0 to 59, i.e. the Seconds of a minute. Syntax: public int getSecond() Parameter: This method does not accept any parameter. Returns: This method returns an 1 min read Like