Java Date Time - OffsetTime isEqual(OffsetTime other) example








OffsetTime isEqual(OffsetTime other) checks if the instant of this OffsetTime is equal to that of the specified time applying both times to a common date.

Syntax

isEqual has the following syntax.

public boolean isEqual(OffsetTime other)

Example

The following example shows how to use isEqual.

import java.time.OffsetTime;
/*from   w  ww.  jav a2  s.  c  om*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();

    System.out.println(m.isEqual(OffsetTime.now()));

  }
}

The code above generates the following result.