CountDown Timer

CountDown Timer for HighTechNorth

by shanejones

HTML

<span id="days"></span>
Days

<span id="hours"></span>
Hours

<span id="minutes"></span>
Minutes

<span id="seconds"></span>
Seconds

JavaScript

var endDay = new Date('August 26, 2019 11:30:00');

var countDown = setInterval(function(){
    var currentDate = new Date();
    var daysdecimal = (endDay - currentDate)/(1000*60*60*24);
    var daysLeft = Math.floor(daysdecimal);
    var hoursdecimal = (daysdecimal - Math.floor(daysdecimal))*24;
    var hoursLeft = Math.floor(hoursdecimal);
    var minLeft = 60 - currentDate.getMinutes();
    var secLeft = 60 - currentDate.getSeconds();
    
    $('#days').text(daysLeft);
    $('#hours').text(hoursLeft);
    $('#minutes').text(minLeft);
    $('#seconds').text(secLeft);   
},1000);