Instant range(TemporalField field) example
Description
Instant range(TemporalField field)
gets the
range of valid values for the specified field.
Syntax
range
has the following syntax.
public ValueRange range(TemporalField field)
Example
The following example shows how to use range
.
import java.time.Instant;
import java.time.temporal.ChronoField;
// ww w . j a va 2 s .c om
public class Main {
public static void main(String[] args) {
Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
System.out.println(instant.range(ChronoField.NANO_OF_SECOND));
}
}
The code above generates the following result.