Java Date Time Java Java API
java.time.OffsetTime
public boolean isAfter(OffsetTime other)
Checks if this OffSetTime is after the provided one. It compares the two dates after converting them to epoch nanos:
public boolean isAfter(OffsetTime other) { return toEpochNano() > other.toEpochNano();}
package com.logicbig.example.offsettime;import java.time.OffsetTime;import java.time.ZoneOffset;public class IsAfterExample { 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.isAfter(d2); System.out.println(b); }}
17:40:33.000020-06:0010:20:15.000000100-06:00true
package com.logicbig.example.offsettime;import java.time.OffsetTime;import java.time.ZoneOffset;public class IsAfterExample2 { 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.isAfter(d2); System.out.println(b); }}
17:40:33.000020-06:0010:20:15.000000100-14:00false