计算两个时间之间相差了多少时间

Date的话如下

int minutes = (int) ((date2.getTime() - date.getTime())/(1000 * 60));  

其他单位改改算法就行了

如果是时间戳的话,直接减就行了……

原文地址:https://www.cnblogs.com/IceBlueBrother/p/8423141.html