public static void main(String[] args) throws InterruptedException {
Date currentTime = new Date();
Thread.sleep(1000);
Instant instant = currentTime.toInstant();
//毫秒
long haomiao = ChronoUnit.MILLIS.between(instant, Instant.now());
long fen = ChronoUnit.MINUTES.between(instant, Instant.now());
long miao = ChronoUnit.SECONDS.between(instant, Instant.now());
System.out.println(haomiao);
}
Java8使用Instant 判断两个日期相距多少时间
猜你喜欢
转载自blog.csdn.net/corleone_4ever/article/details/104402995
今日推荐
周排行