javascript seconds to min and seconds code example

Example 1: javascript seconds to min and seconds

function convert(value) {
    return Math.floor(value / 60) + ":" + (value % 60 ? value % 60 : '00')
}

Example 2: javascript minute and second to convert seconds

function str_pad_left(string,pad,length) {
    return (new Array(length+1).join(pad)+string).slice(-length);
}

var finalTime = str_pad_left(minutes,'0',2)+':'+str_pad_left(seconds,'0',2);

Example 3: convert minutes into seconds javascript

function convertMinutestoSeconds(minutes) 
    {
      return Math.floor(minutes * 60);
    }
    var minutesToSeconds = convertMinutestoSeconds(2); // convert minutes to second javascript 
    document.write( "Result of converting minutes to seconds :- " + minutesToSeconds );