Java计算时间差
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
long time = simpleDateFormat.parse("2020-6-29 9:40").getTime();
long time1 = simpleDateFormat.parse("2020-6-29 10:30").getTime();
long minutes = ChronoUnit.MINUTES.between(Instant.ofEpochMilli(time), Instant.ofEpochMilli(time1));
System.out.println(minutes);

浙公网安备 33010602011771号