import java.util.Date;//from NowJava.com - 时 代 Java
import java.time.Instant;
public class Main {
public static void main(String[] args) {
// Get the current date
Date dt = new Date();
System.out.println("Date: " + dt);
// Convert the Date to an Insatnt
Instant in = dt.toInstant();
System.out.println("Instant: " + in);
// Convert the Instant back to a Date
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。