OffsetDateTime isAfter() method in Java with examples
The isAfter() method of OffsetDateTime class in Java checks checks if this date is after the specified date-time and returns true if it is.
public boolean isAfter(OffsetDateTime other)
Parameter: This method accepts a single parameter other which checks if this date-time is after the another date-time.
Return Value: It returns true if this is after the other date-time, else it returns false.
Below programs illustrate the isAfter() method:
Date1: 2018-12-12T13:30:30+05:00 Date2: 2018-12-12T13:30:30+05:00 Is Date1 after Date2? false
Date1: 2018-12-12T13:30:30+05:00 Date2: 2015-12-12T13:30:30+05:00 Is Date1 after Date2? true
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.