function formatDuring(mss) { var days = parseInt(mss / (1000 * 60 * 60 * 24)); var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60)); var seconds = (mss % (1000 * 60)) / 1000; var returnStr = ""; if (days > 0) { returnStr += days + "天"; } if (hours > 0) { returnStr += hours + "小时"; } if (minutes > 0) { returnStr += minutes + "分钟"; } return returnStr + seconds + "秒"; }