OffsetTime isBefore(OffsetTime other) example

Description

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  w w.  j a  v  a  2 s .  c om
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.





















Home »
  Java Date Time »
    java.time Reference »




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