Java Date Time - OffsetTime isSupported(TemporalUnit unit) example








OffsetTime isSupported(TemporalUnit unit) checks if the specified unit is supported.

Syntax

isSupported has the following syntax.

public boolean isSupported(TemporalUnit unit)

Example

The following example shows how to use isSupported.

import java.time.OffsetTime;
import java.time.temporal.ChronoUnit;
/*from   www  .j a  v a 2s .c o  m*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    boolean z = m.isSupported(ChronoUnit.HOURS);
    System.out.println(z);

  }
}

The code above generates the following result.