Java tutorial
import java.time.LocalDateTime; import java.time.temporal.ChronoField; public class Main { public static void main(String[] args) { LocalDateTime now = LocalDateTime.now(); System.out.println(now.isSupported(ChronoField.YEAR)); System.out.println(now.isSupported(ChronoField.HOUR_OF_DAY)); System.out.println(ChronoField.YEAR.isSupportedBy(now)); System.out.println(ChronoField.HOUR_OF_DAY.isSupportedBy(now)); } }