programming-examples/js/Date/Write a JavaScript function that will return the number of minutes in hours and minutes..js

10 lines
312 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
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));