Java Date Time - LocalTime isBefore(LocalTime other) example








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;

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.