You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
500 B
JavaScript
18 lines
500 B
JavaScript
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 + "秒";
|
|
}
|