OffsetTime isBefore() method in Java with examples
The isBefore() method of OffsetTime class in Java formats checks if the passed time is before the specified time in the parameter.
public boolean isBefore(OffsetTime other)
Parameter: This method accepts a single mandatory parameter other which specifies the time to be compared with.
Return Value: It returns true if the date is before the passed date, else it return false.
Below programs illustrate the isBefore() method:
Program 1 :
time1: 15:30:30+07:00 time1: 15:20:30+07:00 time1 is before time2: false
Program 2 :
time1: 15:30:30+07:00 time1: 15:30:30+07:00 time1 is before time2: false
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.