LocalTime isBefore(LocalTime other) example

Description

LocalTime isBefore(LocalTime other) checks if this LocalTime is before the specified time.

Syntax

isBefore has the following syntax.


public boolean isBefore(LocalTime other)

Example

The following example shows how to use isBefore.


import java.time.LocalTime;
// w  ww.  j a  va2s . co m
public class Main {
  public static void main(String[] args) {
    LocalTime l = LocalTime.now();

    System.out.println(l.isBefore(LocalTime.NOON));
  }
}

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