Java Date Time - ZonedDateTime toLocalTime() example

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


toLocalTime has the following syntax.

public LocalTime toLocalTime()


The following example shows how to use toLocalTime.

import java.time.LocalTime;
import java.time.ZonedDateTime;
// w w  w  .jav a2  s  . c  o m
public class Main {
  public static void main(String[] args) {
    ZonedDateTime dateTime;
    LocalTime l = dateTime.toLocalTime();

The code above generates the following result.