Skip to content

Instantly share code, notes, and snippets.

@dwihujianto
Created March 21, 2017 05:54
Show Gist options
  • Select an option

  • Save dwihujianto/3a9f9e0ef2c7c2f05fc71901b71526ff to your computer and use it in GitHub Desktop.

Select an option

Save dwihujianto/3a9f9e0ef2c7c2f05fc71901b71526ff to your computer and use it in GitHub Desktop.
NodeJs convert minutes to day,hour and minute
const convert = (minute) => {
const MINS_PER_DAY = 24 * 60
let minutes = minute
let days = Math.floor(minute / MINS_PER_DAY)
let hour = minutes - days * MINS_PER_DAY
hour = Math.floor(hour / 60)
minutes = minutes - (hour * 60) - days * MINS_PER_DAY
return `${days} hari, ${hour} jam , ${minutes} menit`
}
hari = convert(process.argv[2])
console.log(hari)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment