Month getLong() method in Java Last Updated : 22 Mar, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The getLong() method is a built-in method of the Month ENUM which is used to get the value of the specified temporal field from this month instance as a long. Syntax: public long getLong(TemporalField field) Parameters: This method accepts a single parameter field whose long representation will be returned from this month instance. Return Value: This method returns the value for the specified field as a long. Below programs illustrate the above method: Program 1: Java import java.time.*; import java.time.Month; import java.time.temporal.ChronoField; class monthEnum { public static void main(String[] args) { // Create a month instance Month month = Month.MARCH; // Get the value of field System.out.println(month.getLong(ChronoField.MONTH_OF_YEAR)); } } Output: 3 Program 2: Java import java.time.*; import java.time.Month; import java.time.temporal.ChronoField; class monthEnum { public static void main(String[] args) { // Create a month instance Month month = Month.DECEMBER; // Get the value of field System.out.println(month.getLong(ChronoField.MONTH_OF_YEAR)); } } Output: 12 Reference: https://docs.oracle.com/javase/8/docs/api/java/time/Month.html#getLong-java.time.temporal.TemporalField- Comment More infoAdvertise with us Next Article Month get() method in Java G gopaldave Follow Improve Article Tags : Java Java-Functions Java-time package Java-Month Practice Tags : Java Similar Reads Month get() method in Java The get() method is a built-in method of the Month ENUM which is used to get the corresponding integral value of the month-of-year values specified by this Month instance. Syntax: public int get(TemporalField field) Parameters: This method accepts a single parameter which is a temporal object and ca 1 min read YearMonth getMonth() method in Java The getMonth() method of YearMonth class in Java is used to get the month field from this YearMonth instance with which it is used. It returns the month field as a Month instance. Syntax: public Month getMonth() Parameter: This method does not accepts any parameter. Return Value: It returns the mont 1 min read YearMonth getMonthValue() method in Java The getMonthValue() method of YearMonth class in Java is used to get the value of the month field from this YearMonth instance with which it is used. It returns the value of the month field as an integer between 1-12 denoting months from January to December. Syntax: public int getMonthValue() Parame 1 min read Month of() method in Java The of() method is a built-in method of the Month ENUM which is used to generate a Month instance from an integer value. The integer value should be in the range 1-12 representing any of the 12 months and the method generates a Month instance from it representing a month-of-year. Syntax: public stat 1 min read Month adjustInto() method in Java The adjustInto() method of java.time.Month ENUM is an in-built function in Java which takes a Temporal object specifying a date and returns a new Temporal object of the same observable type as the input with the month replaced with this month-of-year. Method Declaration: public Temporal adjustInto(T 2 min read MonthDay getLong() method in Java with Examples The getLong() method of MonthDay class in Java gets the value of the specified field from this month-day as an long. Syntax: public long getLong(TemporalField field) Parameter: This method accepts a parameter field which specifies the field to getLong and not null. Returns: The function returns the 2 min read Like