Java Date Time - Month isSupported(TemporalField field) example








Month isSupported(TemporalField field) checks if the specified field is supported.

Syntax

isSupported has the following syntax.

public boolean isSupported(TemporalField field)

Example

The following example shows how to use isSupported.

import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.ChronoField;
/* w  ww. ja  v  a2s . co  m*/
public class Main {
  public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());
    
    System.out.println(m.isSupported(ChronoField.MONTH_OF_YEAR));

  }
}

The code above generates the following result.