How to set a start point for a countdown

Screen Shot 2020-06-09 at 12.29.43 PM

I’m trying to do 3 bars like this, first one which is the date that counts down works fine, for the second one i’m trying to set a start number something like 12760 but I couldn’t figure it out, but it’s counting up.

If you share your code and identify the part that you need help with, someone here may be able to give you advice. Without your code, we can’t help.

var count = new Date("january 1, 2021 00:00:00").getTime();
var x = setInterval(function () {
var now = new Date().getTime();
var d = count - now;
var b = count + now;

var days = Math.floor(d/(1000*60*60*24));


document.getElementById("days").innerHTML = days;

 
if(d <= 0) {
  clearInterval(x);
}

},1000);


var countR = new Date("2342").getTime();
var x = setInterval(function () {
var now = new Date().getTime();
var b = countR + now;

var impressions = Math.floor(b%(1000*60*60*24));


document.getElementById("impressions").innerHTML = impressions;
 
if(d <= 0) {
  clearInterval(x);
}

},1000);
// ]]></script>```


This is the both the first and the second code, I've tried to replicate

I don’t get it. Why are you using a date if you just want a fixed starting number?

The date is for the first circle, i don’t know how to do fixed starting number so I coppied the first one and tried to play with it.

Maybe I’m just not understanding what you are trying to do.

Can’t you just assign a number to a variable and increment or decrement it inside setInterval?

let number = 12760;

setInterval(() => {
  console.log(number--)
}, 1000)