时间戳时间
Date date = new Date(1540535801*1000L);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//时间戳转换为指定的时间格式
System.out.println(sdf.format(date));
String time = "2018-10-26 14:36:41";
//时间转换为时间戳(sdf格式与time格式要相互对应)
System.out.println(sdf.parse(time).getTime());
//获取当前时间的时间戳
System.out.println(System.currentTimeMillis());
System.out.println(new Date().getTime());
时间戳以秒为单位
1天=86400秒
一年=365天=31536000秒