Date类
/*
java.util, extends Object,
implements Serializable, Cloneable, Comparable<Date>
*/
public class DateDemo {
public static void main(String[] args) {
//public Date(); 分配一个Date对象,并初始化,表示它被分配的时间,精确到毫秒.
Date date = new Date();
System.out.println(date);
//Sun Feb 12 12:08:06 CST 2023
//public Date(long date); 分配一个Date对象,并初始化为从基准时间到指定时间的毫秒数.
long l = 1000*60*60*24*10;//秒,分,时,天,10天
Date d = new Date(l);
System.out.println(d);
//Sun Jan 11 08:00:00 CST 1970
}
}
标签:常用,Sun,System,60,date,API,Date,public
From: https://www.cnblogs.com/lg369/p/17113659.html