首页javadateJava Data Type - 如何从Instant获取价值

Java Data Type - 如何从Instant获取价值

我们想知道如何从Instant获取价值。
import java.time.Instant;

public class Main {

  public static void main(String[] args) {
    Instant now = Instant.now();
    System.out.println(now);
    System.out.println(now.getEpochSecond());
    System.out.println(now.getNano());
  }
}