Java Date Time - OffsetTime isBefore(OffsetTime other) example








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

Syntax

isBefore has the following syntax.

public boolean isBefore(OffsetTime other)

Example

The following example shows how to use isBefore.

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

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

  }
}

The code above generates the following result.