DayOfWeek range(TemporalField field) example
Description
DayOfWeek range(TemporalField field)
gets the
range of valid values for the specified field.
The range object expresses the minimum and maximum valid values for a field.
Syntax
range
has the following syntax.
public ValueRange range(TemporalField field)
Example
The following example shows how to use range
.
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.ChronoField;
/*w ww. jav a2 s. c om*/
public class Main {
public static void main(String[] args) {
LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
System.out.println(dayOfWeek.range(ChronoField.DAY_OF_WEEK));
}
}
The code above generates the following result.