Java Date Time Java Java API
java.time.LocalDate
public Month getMonth()
Returns the Month enum for the month field corresponding to this local date.
package com.logicbig.example.localdate;import java.time.LocalDate;import java.time.Month;import java.time.format.TextStyle;import java.util.Locale;public class GetMonthExample { public static void main (String... args) { LocalDate d = LocalDate.of(2014, 10, 10); Month month = d.getMonth(); System.out.println(month); System.out.println(month.getValue()); System.out.println(month.getDisplayName(TextStyle.SHORT, Locale.US)); }}
OCTOBER10Oct