Instant start = Instant.now(); // XXXXXXXX(你的代码) Instant end = Instant.now(); //时间搓对象 Duration timeElapsed = Duration.between(start, end); //不同格式展示,下面是分钟和秒的样子,还有小时天这些 long l = timeElapsed.toMinutes(); long ls = timeElapsed.toMillis(); System.out.println("l = " + l); System.out.println("ls = " + ls);
原文地址:https://www.cnblogs.com/asusdell/p/11937040.html
时间: 2024-10-28 21:46:52