OffsetDateTime timeLineOrder() example

Description

OffsetDateTime timeLineOrder() gets a comparator that compares two OffsetDateTime instances based solely on the instant.

Syntax

timeLineOrder has the following syntax.


public static Comparator<OffsetDateTime> timeLineOrder()

Example

The following example shows how to use timeLineOrder.


import java.time.OffsetDateTime;
import java.util.Comparator;
//from   w ww  . j a  v a 2 s .  c o m
public class Main {
  public static void main(String[] args) {
    Comparator<OffsetDateTime> o = OffsetDateTime.timeLineOrder();
    
    System.out.println(o);
  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset