Last active
August 16, 2019 11:59
-
-
Save theycallmemac/36a0bfa7455c74dd50a76d2190478e91 to your computer and use it in GitHub Desktop.
discordbot-uptime.js
This file contains 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 [ , , ...args ] = process.argv; | |
let totalSeconds = args[0]; | |
let days = Math.floor(totalSeconds / 86400); | |
let hours = Math.floor(totalSeconds / 3600) - (days * 24); | |
totalSeconds %= 3600; | |
let minutes = Math.floor(totalSeconds / 60); | |
let seconds = Math.round(totalSeconds % 60); | |
console.log(`${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment