Skip to main content

Convert seconds to minutes in JavaScript.

// @returns string  ex: 7:11
function convertSecondsToMinutes(totalSeconds) {
  var minutes = Math.floor(totalSeconds / 60); // The minutes
  var seconds = totalSeconds % 60; // The balance of seconds
  return minutes + ':' + seconds; // ex: 7:11
}