Java Date Time Java Java API
java.time.ZonedDateTime
public int getMonthValue()
Returns the month-of-year field as int.
package com.logicbig.example.zoneddatetime;import java.time.ZonedDateTime;public class GetMonthValueExample { public static void main(String... args) { ZonedDateTime d = ZonedDateTime.now(); int monthValue = d.getMonthValue(); System.out.println(monthValue); }}
5