// Date date = new Date();//当前时间
// String otherTime = "2022-12-20 12:59:00";
// SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date time = sf.parse(otherTime);
// long nd = 1000*24*60*60;//一天的毫秒数
// long nh = 1000*60*60;//一小时的毫秒数
// long nm = 1000*60;//一分钟的毫秒数
// // 当前时间与其他时间相差的毫秒数
// long diff = date.getTime() - time.getTime();
// long sec = diff / 1000;
// long min = diff / 60 / 1000;
// long hours = diff / 60 / 60 / 1000;
// System.out.println("相差多少分钟" + min);
// System.out.println("相差多少小时" + hours+"-----"+diff%nd%nh/nm);```
04-23
2677
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-01
05-29