Checks if this OffSetTime is after the provided one. It compares the two dates after converting them to epoch nanos:
package com.logicbig.example.offsettime;
import java.time.OffsetTime;
import java.time.ZoneOffset;
public class IsBeforeExample {
public static void main(String... args) {
OffsetTime d1 = OffsetTime.of(17, 40, 33, 20000, ZoneOffset.ofHours(-6));
System.out.println(d1);
OffsetTime d2 = OffsetTime.of(10, 20, 15, 100, ZoneOffset.ofHours(-6));
System.out.println(d2);
boolean b = d1.isBefore(d2);
System.out.println(b);
}
}
Output
17:40:33.000020-06:00
10:20:15.000000100-06:00
false
package com.logicbig.example.offsettime;
import java.time.OffsetTime;
import java.time.ZoneOffset;
public class IsBeforeExample2 {
public static void main(String... args) {
OffsetTime d1 = OffsetTime.of(17, 40, 33, 20000, ZoneOffset.ofHours(-6));
System.out.println(d1);
OffsetTime d2 = OffsetTime.of(10, 20, 15, 100, ZoneOffset.ofHours(-14));
System.out.println(d2);
boolean b = d1.isBefore(d2);
System.out.println(b);
}
}
Output
17:40:33.000020-06:00
10:20:15.000000100-14:00
true