有谁能帮助我Date以有效的方式计算天数方面的差异?
Date nextCollectionDate = dispenseNormal.getDispensing().getNextCollectionDate();
Date currentDate = new Date();
int daysDiff = currentDate - nextCollectionDate;
Run Code Online (Sandbox Code Playgroud)
//diff in msec
long diff = currentDate.getTime() - nextCollectionDate.getTime();
//diff in days
long days = diff / (24 * 60 * 60 * 1000);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4982 次 |
| 最近记录: |