function transTime(time) {
if(time === '') {
return '';
} else {
var result = '';
if(time >= 1000) {
var day = parseInt(time / (24*60*60*1000));
var hour = parseInt((time % (24*60*60*1000)) / (60*60*1000));
var minute = parseInt(((time % (24*60*60*1000)) % (60*60*1000)) / (60*1000));
var second = parseInt((((time % (24*60*60*1000)) % (60*60*1000)) % (60*1000)) / 1000);
if(day != 0) {
result += day + '天';
}
if(hour != 0) {
result += hour + '时';
}
if(minute != 0) {
result += minute + '分';
}
if(second != 0) {
result += second + '秒';
}
}
if(result == '') {
result = '0秒';
}
return result;
}
}
觉得辛苦就扫一扫: