Java ZonedDateTime create from LocalDate, LocalTime and ZoneId

Description

Java ZonedDateTime create from LocalDate, LocalTime and ZoneId

import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;

public class Main {
  public static void main(String[] args) {

    LocalDate dateOnly = LocalDate.now();
    ZonedDateTime zdt = ZonedDateTime.of(dateOnly, 
        LocalTime.of(8, 45), //from ww w. j  a  v a  2s  .  co m
        ZoneId.of("America/Chicago"));

    System.out.println(zdt + " adjusted to " + zdt);
  }
}



PreviousNext

Related