Month 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.LocalDate; import java.time.Month; import java.time.temporal.ChronoField; //from w w w . ja v a 2 s.c o m public class Main { public static void main(String[] args) { Month m = Month.from(LocalDate.now()); System.out.println(m.range(ChronoField.MONTH_OF_YEAR)); } }
The code above generates the following result.