programming-examples/js/Date/Write a JavaScript function that will return the number of minutes in hours and minutes..js
2019-11-15 12:59:38 +01:00

10 lines
312 B
JavaScript

function timeConvert(n) {
var num = n;
var hours = (num / 60);
var rhours = Math.floor(hours);
var minutes = (hours - rhours) * 60;
var rminutes = Math.round(minutes);
return num + " minutes = " + rhours + " hour(s) and " + rminutes + " minute(s).";
}
console.log(timeConvert(200));