Created
March 21, 2017 05:54
-
-
Save dwihujianto/3a9f9e0ef2c7c2f05fc71901b71526ff to your computer and use it in GitHub Desktop.
NodeJs convert minutes to day,hour and minute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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