Java Date Time - LocalDateTime isAfter (ChronoLocalDateTime other)








LocalDateTime isAfter(ChronoLocalDateTime<?> other) checks if this date-time is after the specified date-time.

Syntax

isAfter has the following syntax.

public boolean isAfter(ChronoLocalDateTime<?> other)

Example

The following example shows how to use isAfter.

import java.time.LocalDateTime;
/*from w  ww  . ja v  a  2s.  c o  m*/
public class Main {
  public static void main(String[] args) {
    LocalDateTime a = LocalDateTime.of(2012, 6, 30, 12, 00);
    LocalDateTime b = LocalDateTime.of(2012, 7, 1, 12, 00);
    System.out.println(a.isAfter(b));
    System.out.println(a.isAfter(a));
  }
}

The code above generates the following result.