OffsetDateTime range(TemporalField field)
gets the range of valid values for the specified field.
range
has the following syntax.
public ValueRange range(TemporalField field)
The following example shows how to use range
.
import java.time.OffsetDateTime; import java.time.temporal.ChronoField; import java.time.temporal.ValueRange; //from w w w.j av a 2s . c om public class Main { public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); ValueRange l = o.range(ChronoField.DAY_OF_WEEK); System.out.println(l); } }
The code above generates the following result.