OffsetDateTime compareTo(OffsetDateTime other) example
Description
OffsetDateTime compareTo(OffsetDateTime other)
compares this OffsetDateTime to another date-time.
Syntax
compareTo
has the following syntax.
public int compareTo(OffsetDateTime other)
Example
The following example shows how to use compareTo
.
import java.time.OffsetDateTime;
/* ww w . ja v a2s . c o m*/
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.