Date d1 = vo.getAllocationtime();
Date d2 = new Date();
long diff = d2.getTime() - d1.getTime();//这样得到的差值是微秒级别
long days = diff / (1000 * 60 * 60 * 24);
long hours = (diff-days*(1000 * 60 * 60 * 24))/(1000* 60 * 60);
long minutes = (diff-days*(1000 * 60 * 60 * 24)-hours*(1000* 60 * 60))/(1000* 60);
if(days>0) {
vo.setDayHourMinuteDCL(""+days+":"+hours+":"+minutes);
}else {
vo.setDayHourMinuteDCL(""+hours+":"+minutes);
}
时间: 2024-10-03 23:27:28