Java Date Time Java Java API
java.time.DayOfWeek
public boolean isSupported(TemporalField field)
The method DayOfWeek.isSupported() checks if the specified field is supported. DayOfWeek will return false for all ChronoField values except for ChronoField.DAY_OF_WEEK.
isSupported() method is defined in the interface TemporalAccessor which is implemented by DayOfWeek.
package com.logicbig.example.dayofweek;import java.time.DayOfWeek;import java.time.LocalDate;import java.time.temporal.ChronoField;public class IsSupportedExample { public static void main (String[] args) { DayOfWeek dayOfWeek = LocalDate.now() .getDayOfWeek(); boolean supported = dayOfWeek.isSupported( ChronoField.DAY_OF_WEEK); System.out.println(supported); supported = dayOfWeek.isSupported( ChronoField.DAY_OF_MONTH); System.out.println(supported); }}
truefalse