Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

convert minutes to hour and minute js

const convertMinutes = (minutes) => {
  if (minutes === null || minutes == 0 || isNaN(minutes)) return "Undefined";
  let h = Math.trunc(time / 60);
  let m = time % 60;

  let hDisplay = h > 0 ? h + (h === 1 ? " Hour " : " Hours ") : "";
  let mDisplay = m > 0 ? m + (m === 1 ? " Minute " : " Minutes ") : "";

  return hDisplay + mDisplay;
}
 
PREVIOUS NEXT
Tagged: #convert #minutes #hour #minute #js
ADD COMMENT
Topic
Name
7+9 =