Skip to content

Instantly share code, notes, and snippets.

@klashxx
Created October 26, 2017 08:32
Show Gist options
  • Select an option

  • Save klashxx/51ed684e31fe34dbda481e5f8dd7f87a to your computer and use it in GitHub Desktop.

Select an option

Save klashxx/51ed684e31fe34dbda481e5f8dd7f87a to your computer and use it in GitHub Desktop.
function formatMins(minutos) {
var mins_num = parseInt(minutos, 10)
if (mins_num == undefined) {
return 'Indeterminado.'
}
if (mins_num < 60 ){
return mins_num + ' minutos.'
}
var horas = Math.floor(mins_num / 60)
var mins = Math.floor((mins_num - ((horas * 3600)) / 60))
if (horas < 10) {horas = '0' + horas}
if (mins < 10) {mins = '0' + mins}
return horas + ' Horas y ' + mins + ' minutos.'
}
// formatMins(Math.floor((new Date - start) / 1000 /60)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment