Skip to content

Instantly share code, notes, and snippets.

@theycallmemac
Last active August 16, 2019 11:59
Show Gist options
  • Save theycallmemac/36a0bfa7455c74dd50a76d2190478e91 to your computer and use it in GitHub Desktop.
Save theycallmemac/36a0bfa7455c74dd50a76d2190478e91 to your computer and use it in GitHub Desktop.
discordbot-uptime.js
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