seconds to minutes:seconds conversion javascript 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: 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 );