Month firstMonthOfQuarter() method in Java Last Updated : 22 Mar, 2019 Comments Improve Suggest changes Like Article Like Report The firstMonthOfQuarter() is a built-in method of the Month ENUM which is used to get the first month corresponding to this quarter. The quarter is defined by dividing the year into 4 groups as: Group 1: JANUARY, FEBRUARY, MARCH Group 2: APRIL, MAY, JUNE Group 3: JULY, AUGUST, SEPTEMBER Group 4: OCTOBER, NOVEMBER, DECEMBER Syntax: public int firstMonthOfQuarter() Parameters: This method does not accepts any parameters. Return Value: This method returns the month corresponding to the first month of this quarter. Below programs illustrate the above method: Program 1: Java import java.time.*; import java.time.Month; import java.time.temporal.Temporal; class DayOfWeekExample { public static void main(String[] args) { // Set the month to february, 1st Quarter Month month = Month.of(2); // Get the first month of this quarter System.out.println(month.firstMonthOfQuarter()); } } Output: JANUARY Program 2: Java import java.time.*; import java.time.Month; import java.time.temporal.Temporal; class DayOfWeekExample { public static void main(String[] args) { // Set the month to JUNE, 2nd Quarter Month month = Month.of(6); // Get the first month of this quarter System.out.println(month.firstMonthOfQuarter()); } } Output: APRIL Reference: https://docs.oracle.com/javase/8/docs/api/java/time/Month.html#firstMonthOfQuarter-- Comment More infoAdvertise with us Next Article YearMonth getMonthValue() method in Java G gopaldave Follow Improve Article Tags : Java Java-Functions Java-time package Java-Month Practice Tags : Java Similar Reads Month firstDayOfYear() method in Java The firstDayOfYear() is a built-in method of the Month ENUM which is used to get the day of year corresponding to the first day of this month. Syntax: public int firstDayOfYear(boolean leapYear) Parameters: This method accepts a single parameter leapYear, which is a boolean flag variable indicating 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 YearMonth format() method in Java The format() method of YearMonth class in Java is used to format this YearMonth instance according to a specified DateTimeFormatter for year-month passed as parameter to this method. Syntax: public String format(DateTimeFormatter formatter) Parameter: This method accepts a single parameter formatter 1 min read Month getLong() method in Java 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 r 1 min read YearMonth atEndOfMonth() method in Java The atEndOfMonth() method of YearMonth class in Java is used to return a LocalDate of the last day of month based on this YearMonth object with which it is used. Syntax: public LocalDate atEndOfMonth() Parameter: This method does not accepts any parameter. Return Value: It returns a Local Date with 2 min read Like