获取json化的时间相差的秒

import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
/**
* 期间
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return {@link String}
*/
private long duration(Date startTime, Date endTime) {
Instant startInstant = startTime.toInstant();
Instant endInstant = endTime.toInstant();
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime start = startInstant.atZone(zoneId).toLocalDateTime();
LocalDateTime end = endInstant.atZone(zoneId).toLocalDateTime();
long minutes = Duration.between(start, end).toMinutes();
return minutes * 60;
}
上一篇:VS2015+QT5.7遇到 This application failed to start because it could not find or load the Qt platform


下一篇:并行流