Java Date Time - OffsetDateTime toOffsetTime() example

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


toOffsetTime has the following syntax.

public OffsetTime toOffsetTime()


The following example shows how to use toOffsetTime.

import java.time.OffsetDateTime;
import java.time.OffsetTime;
//from   ww w .  ja  va 2  s. co m
public class Main {
  public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.MAX;
    OffsetTime of = o.toOffsetTime();

The code above generates the following result.