Java ZonedDateTime query LocalTime

Description

Java ZonedDateTime query LocalTime

import java.time.LocalTime;
import java.time.ZonedDateTime;
import java.time.temporal.TemporalQueries;

public class Main {
  public static void main(String[] args) {
    ZonedDateTime zdt = ZonedDateTime.now();
    // Use the localTime() query
    LocalTime lt3 = zdt.query(TemporalQueries.localTime());

    System.out.println("lt3: " + lt3);
  }/*from  ww  w.  j  ava  2s.c  o  m*/
}



PreviousNext

Related