1、获取当前时间戳
//方法 一
System.currentTimeMillis();
//方法 二
Calendar.getInstance().getTimeInMillis();
//方法 三
new Date().getTime();
2、时间和日期转换
把String类型的时间转换为Date类型 new SimpleDateFormat("yyyy-MM-dd").parse("1970-01-01").getTime()
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
java.util.Date time=null;
try {
time= sdf.parse(sdf.format(new Date()));
} catch (ParseException e) {
e.printStackTrace();
}