①Date
Date date = new Date();
long time = date.getTime();//当前时间的毫秒数
②Calendar
//获取当前日历时间
Calendar calendar = Calendar.getInstance();
//获取当前时间毫秒数
long time = calendar.getTimeInMillis();
③System
//获取当前时间的毫秒数
long time = System.currentTimeMillis();
④Instant
//获取当前时间
Instant nowtime = Instant.now();
//获取当前时间戳——秒
long second = nowtime.getEpochSecond();
//获取当前时间戳——毫秒
long msecond = nowtime.toEpochMilli();