MonthDay range(TemporalField field) example

Description

MonthDay 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.MonthDay;
import java.time.temporal.ChronoField;
import java.time.temporal.ValueRange;
//from   w w w  .  ja v a  2s  . co m
public class Main {
  public static void main(String[] args) {
    MonthDay m = MonthDay.now();
    ValueRange n = m.range(ChronoField.MONTH_OF_YEAR);
    System.out.println(n);

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset