2019-11-19

public static String getDatePoor(Date endDate, Date nowDate) {

long nd = 1000 * 24 * 60 * 60;//每天毫秒数

long nh = 1000 * 60 * 60;//每小时毫秒数

long nm = 1000 * 60;//每分钟毫秒数

long diff = endDate.getTime() - nowDate.getTime(); // 获得两个时间的毫秒时间差异

long day = diff / nd; // 计算差多少天

long hour = diff % nd / nh; // 计算差多少小时

long min = diff % nd % nh / nm; // 计算差多少分钟

return day + "天" + hour + "小时" + min + "分钟";

}

你可能感兴趣的:(2019-11-19)