js 时间戳转化为时分秒

var toHHmmss = function (data) {
        var s;
        var hours = parseInt((data % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
        var minutes = parseInt((data % (1000 * 60 * 60)) / (1000 * 60));
        var seconds = (data % (1000 * 60)) / 1000;
        s = (hours < 10 ? ('0' + hours) : hours) + ':' + (minutes < 10 ? ('0' + minutes) : minutes) + ':' + (seconds < 10 ? ('0' + seconds) : seconds);
        return s;
    };

var MODECONTENT = {
    toHHmmss: toHHmmss,//毫秒整数转化为时分秒(例如:00:30:00)
}

 

你可能感兴趣的:(代码集)