Java LocalDate get field value via ChronoField
import java.time.LocalDate; import java.time.temporal.ChronoField; public class Main { public static void main(String[] args) { LocalDate today = LocalDate.now(); System.out.println("Current Date : " + today); System.out.println("LocalDate supports year: " + today.isSupported(ChronoField.YEAR)); System.out.println("LocalDate supports hour-of-day: " + today.isSupported(ChronoField.HOUR_OF_DAY)); System.out.println("Year is supported by LocalDate: " + ChronoField.YEAR.isSupportedBy(today)); System.out.println("Hour-of-day is supported by LocalDate: " + ChronoField.HOUR_OF_DAY.isSupportedBy(today)); }/*from w w w . ja v a2 s . co m*/ }