how to do the calculation of this statement
var dateTo = new Date(2019,04,03,3,15,0);
var countdown = Math.round((dateTo.getTime() - new Date().getTime()) / 1000);
how to do the calculation of this statement
var dateTo = new Date(2019,04,03,3,15,0);
var countdown = Math.round((dateTo.getTime() - new Date().getTime()) / 1000);
Is the value not what you expected? Try to print the date and make sure the value is what you wanted:
var dateTo = new Date(2019,04,03,3,15,0);
console.log(dateTo);
Also it is better to use only 4 and 3 instead of "04" and "03".
is this what you're going for?
#// Set the date we're counting down to
var countDownDate = new Date("Jan 5, 2021 15:37:25").getTime();
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
console.warn("val", days);