// set the date we're counting down to var target_date1 = new Date('May, 05, 2024').getTime(); // variables for time units var days, hours, minutes, seconds; // get tag element var countdown1 = document.getElementById('countdown1'); // set the date we're counting down to var target_date2 = new Date('May, 05, 2024').getTime(); // variables for time units var days, hours, minutes, seconds; // get tag element var countdown2 = document.getElementById('countdown2'); // update the tag with id "countdown" every 1 second setInterval(function () { // find the amount of "seconds" between now and target var current_date = new Date().getTime(); var seconds_left1 = (target_date1 - current_date) / 1000; // do some time calculations days1 = parseInt(seconds_left1 / 86400); seconds_left1 = seconds_left1 % 86400; hours1 = parseInt(seconds_left1 / 3600); seconds_left1 = seconds_left1 % 3600; minutes1 = parseInt(seconds_left1 / 60); seconds1 = parseInt(seconds_left1 % 60); var seconds_left2 = (target_date2 - current_date) / 1000; // do some time calculations days2 = parseInt(seconds_left2 / 86400); seconds_left2 = seconds_left2 % 86400; hours2 = parseInt(seconds_left2 / 3600); seconds_left2 = seconds_left2 % 3600; minutes2 = parseInt(seconds_left2 / 60); seconds2 = parseInt(seconds_left2 % 60); // format countdown string + set tag value countdown1.innerHTML = '' + days1 + ' ' + hours1 + ' ' + minutes1 + ' ' + seconds1 + ' '; countdown2.innerHTML = '' + days2 + ' ' + hours2 + ' ' + minutes2 + ' ' + seconds2 + ' '; }, 1000);