在js中使用moment将秒转换为多少天多少小时多少分多少秒
let x = 2703750;//单位是秒 var d = moment.duration(x, 'seconds'); console.log(Math.floor(d.asDays()) + '天' + d.hours() + '时' + d.minutes() + '分' + d.seconds() + '秒');
输出结果为31天7时2分30秒
最大单位到天
let x = 2703750;//单位是秒 var d = moment.duration(x, 'seconds'); console.log(Math.floor(d.asDays()) + '天' + d.hours() + '时' + d.minutes() + '分' + d.seconds() + '秒');
输出结果为31天7时2分30秒
最大单位到天