/**
 * 将秒格式化为如 02:05
 * @seconds (单位s)
 */
var formatS2M = function (seconds) {
    if (!seconds) return '00:00';
    seconds = Math.round(seconds);
    var durationMinute = parseInt(seconds / 60);
    var durationSecond = parseInt(seconds % 60);
    if (durationSecond < 10) {
        durationSecond = '0' + durationSecond;
    }
    if (durationMinute < 10) {
        durationMinute = '0' + durationMinute;
    }
    return (durationMinute + ':' + durationSecond);
}
Last Updated:
Contributors: pengrengui