js将秒转换成几天几小时几分几秒

function getDuration(second) {
    var days = Math.floor(second / 86400);
    var hours = Math.floor((second % 86400) / 3600);
    var minutes = Math.floor(((second % 86400) % 3600) / 60);
    var seconds = Math.floor(((second % 86400) % 3600) % 60);
    var duration = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒";
    return duration;
}
    原文作者:fly_1c
    原文地址: https://blog.csdn.net/fly_1c/article/details/94620813
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞