Java Date Time Java Java API
java.time.MonthDay
public Month getMonth()
This method returns Month enum corresponding to the month-of-year field of this MonthDay object
Month
package com.logicbig.example.monthday;import java.time.Month;import java.time.MonthDay;public class GetMonthExample { public static void main(String... args) { MonthDay m = MonthDay.of(5, 21); System.out.println(m); Month month = m.getMonth(); System.out.println(month); }}
--05-21MAY