首页javadate_timeJava Data Type - 如何在Java 8中获取当前时间戳

Java Data Type - 如何在Java 8中获取当前时间戳

我们想知道如何在Java 8中获取当前时间戳。
import java.time.Instant;
public class Main {
  public static void main(String[] argv) {
    Instant timestamp = Instant.now();
    System.out.println("What is value of this instant " + timestamp);
  }
}