Java Date Time Java Java API
java.time.MonthDay
public int getMonthValue()
This method returns the value of month-of-year field of this MonthDay object.
package com.logicbig.example.monthday;import java.time.Month;import java.time.MonthDay;public class GetMonthValueExample { public static void main(String... args) { MonthDay m = MonthDay.of(5, 21); System.out.println(m); int v = m.getMonthValue(); System.out.println(v); //alternatively Month month = m.getMonth(); int v2 = month.getValue(); System.out.println(v2); }}
--05-2155