Skip to content

Instantly share code, notes, and snippets.

@TheSainEyereg
Last active December 30, 2020 22:16
Show Gist options
  • Select an option

  • Save TheSainEyereg/2e70d445d77d6b74cf74161fad9da075 to your computer and use it in GitHub Desktop.

Select an option

Save TheSainEyereg/2e70d445d77d6b74cf74161fad9da075 to your computer and use it in GitHub Desktop.
Discord Animated status new year countdown.
let date = '2021';
let gmt = 0; //Default GMT is 0
let timeLeft = (endtime) => {
let t = Date.parse(endtime) - Date.parse(new Date())-(gmt*1000*60*60);
let seconds = Math.floor( (t/1000) % 60 );
let minutes = Math.floor( (t/1000/60) % 60 );
let hours = Math.floor( (t/(1000*60*60)) % 24 );
let days = Math.floor( t/(1000*60*60*24) );
return {
'total': t,
'days': days,
'hours': hours,
'minutes': minutes,
'seconds': seconds
};
};
let time = timeLeft(date);
new String('Until NY: '+time.days+' days, '+time.hours+' hours, '+time.minutes+' minutes,');
"eval let date=\"2021\",gmt=0,timeLeft=e=>{let t=Date.parse(e)-Date.parse(new Date)-1e3*gmt*60*60,a=Math.floor(t/1e3%60),o=Math.floor(t/1e3/60%60),s=Math.floor(t/36e5%24);return{total:t,days:Math.floor(t/864e5),hours:s,minutes:o,seconds:a}},time=timeLeft(date);new String(\"Until NY: \"+time.days+\" days, \"+time.hours+\" hours, \"+time.minutes+\" minutes\")","❄️"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment