Java Instant create from Clock

Description

Java Instant create from Clock

import java.time.Clock;
import java.time.Instant;

public class Main {
  public static void main(String[] args) {
     Clock clock = Clock.systemDefaultZone();
     System.out.println(clock);/*from  w w  w.  j a va2 s .com*/
     

     Instant instant = Instant.now(clock);
     System.out.println(instant);
  }

}



PreviousNext

Related