LocalDateTime计算时间差


LocalDateTime 为java8的新特性之一


LocalDateTime.now() 获得当前时间

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


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

toNanos()//纳秒

toMillis()//毫秒

toMinutes()//分钟

toHours()//小时

toDays()//天数


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



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM