Java Date Time Java Java API
java.time.YearMonth
public int getMonthValue()
Returns the month-of-year field as int from 1 to 12.
package com.logicbig.example.yearmonth;import java.time.YearMonth;public class GetMonthValueExample { public static void main(String... args) { YearMonth y = YearMonth.of(2010, 11); System.out.println(y); int v = y.getMonthValue(); System.out.println(v); }}
2010-1111