Java Clock convert to ZonedDateTime

Description

Java Clock convert to ZonedDateTime

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);/*from www. jav a2  s  . com*/

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

}



PreviousNext

Related