OffsetDateTime compareTo(OffsetDateTime other)
compares this OffsetDateTime to another date-time.
compareTo
has the following syntax.
public int compareTo(OffsetDateTime other)
The following example shows how to use compareTo
.
import java.time.OffsetDateTime; public class Main { public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.MAX; System.out.println(o.compareTo(OffsetDateTime.MIN)); } }
The code above generates the following result.