private String getTimeOutStr(long nowDate, long lastTime) { String str =""; long minute = 1000 * 60 ; long hour = 1000 * 60 * 60 ; long day = 1000 * 60 * 60 * 24; long time = nowDate - lastTime; if(time/day >0){ long dayNum = time / day; str += dayNum + "天"; long hourTime = time % day; if(hourTime/hour > 0){ long hourNum = hourTime / hour; str += hourNum + "小时"; long minuteTime = hourTime % hour; if(minuteTime/minute > 0){ long minuteNum = minuteTime / minute; str += minuteNum + "分钟"; } } }else { if(time/hour > 0){ long hourNum = time / hour; str += hourNum + "小时"; long minuteTime = time % hour; if(minuteTime/minute > 0){ long minuteNum = minuteTime / minute; str += minuteNum + "分钟"; } }else { long minuteNum = time / minute; str += minuteNum + "分钟"; } } return str; }
标签:相差,hour,时分,long,minuteNum,时间,str,time,minute From: https://www.cnblogs.com/szc1998/p/17824496.html