Java Date Time Java Java API
java.time.OffsetDateTime
public Month getMonth()
Returns a Month enum instance, corresponding to the month-of-year field of this OffsetDateTime instance.
package com.logicbig.example.offsetdatetime;import java.time.LocalDateTime;import java.time.Month;import java.time.OffsetDateTime;import java.time.ZoneOffset;public class GetMonthExample { public static void main (String... args) { OffsetDateTime d = OffsetDateTime.of(LocalDateTime.of(2010, 10, 3, 11, 43), ZoneOffset.ofHours(-5)); Month month = d.getMonth(); System.out.println(month); System.out.println(month.getValue()); }}
OCTOBER10