Java Date Time - OffsetTime toLocalTime() example








OffsetTime toLocalTime() gets the LocalTime part of this date-time.

Syntax

toLocalTime has the following syntax.

public LocalTime toLocalTime()

Example

The following example shows how to use toLocalTime.

import java.time.LocalTime;
import java.time.OffsetTime;
/*from ww  w.  j  a  v a2s . c  om*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    LocalTime l = m.toLocalTime();
    System.out.println(l);

  }
}

The code above generates the following result.