OffsetDateTime toOffsetTime() example

Description

OffsetDateTime toOffsetTime() converts this date-time to an OffsetTime.

Syntax

toOffsetTime has the following syntax.


public OffsetTime toOffsetTime()

Example

The following example shows how to use toOffsetTime.


import java.time.OffsetDateTime;
import java.time.OffsetTime;
/*from  www . j  a v  a 2 s. c o  m*/
public class Main {
  public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.MAX;
    OffsetTime of = o.toOffsetTime();
    System.out.println(of);
  }
}

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