Java ZonedDateTime create from Clock

Description

Java ZonedDateTime create from Clock

import java.time.Clock;
import java.time.ZonedDateTime;

public class Main {
  public static void main(String[] args) {
     Clock clock = Clock.systemDefaultZone();
     System.out.println(clock);/*  w ww  .j  a  v  a 2 s  .c om*/

     ZonedDateTime zoneDateTime = ZonedDateTime.now(clock);
     System.out.println(zoneDateTime);
  }

}



PreviousNext

Related