时间戳Timestamp是date的一个瘦包装器 //Timestamp貌似现在没怎么用了
import java.sql.Timestamp;
import java.util.Date;
public class DateTest {
public static void main(String[] args){
//表示 1970 年 1 月 1 日 00:00:00 以来的标准毫秒数
long today = System.currentTimeMillis();
Timestamp timestamp = new Timestamp(today);
System.out.println(today+":"+timestamp.getTime()+":"+timestamp.getDate());
// Date 的使用
Date date = new Date();
System.out.println(date.getDate()+":"+date.toString()+":"+date.getTime());
//相互转化
Date date1 = new Date(timestamp.getTime());
Timestamp timestamp1 = new Timestamp(date.getTime());
System.out.println("时间:"+date1.getDate()+":"+timestamp1.getDate());