LocalDateTime isAfter(ChronoLocalDateTime> other) example
Description
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;
//w w w. j a v a 2 s . c om
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.