Java Date Time Java Java API
java.time.LocalDateTime
public int getMonthValue()
This method returns the month-of-year field value of this LocalDateTime instance.
package com.logicbig.example.localdatetime;import java.time.LocalDateTime;public class GetMonthValueExample { public static void main (String... args) { LocalDateTime dt = LocalDateTime.of(2016, 10, 12, 15, 20, 30); int monthValue = dt.getMonthValue(); System.out.println(monthValue); }}
10