LocalDateTime计算时间差

LocalDateTime 为java8的新特性之一


LocalDateTime.now() 获得当前时间

java.time.Duration duration = java.time.Duration.between(LocalDateTime   startTime,  LocalDateTime  endTime );


例如:     duration.toMinutes()    //两个时间差的分钟数

toNanos()//纳秒

toMillis()//毫秒

toMinutes()//分钟

toHours()//小时

toDays()//天数


原文地址:https://blog.csdn.net/shaoyu_zhu_88/article/details/77148557


原文地址:https://www.cnblogs.com/jpfss/p/11224177.html