public static void main(String[] args) throws InterruptedException {
Date timestrat = new Date();
System.out.println(timestrat);
//睡眠5秒
Thread.sleep(5*1000);
Date timeend = new Date();
System.out.println(timeend);
//单位是毫秒
long miao = (timeend.getTime() - timestrat.getTime())/1000;
System.out.println(miao);
}