How do I set the MSC time zone?
-
I get the time from the database and there must be a timer on the site, for some reason it shows differently on different ip how to set the time zone of the MSC?
Here is the script.
function timeGet(date, ints){ let now = new Date().getTime(); // Find the distance between now an the count down date let distance = ints - now; // Time calculations for days, hours, minutes and seconds let days = Math.floor(distance / (1000 * 60 * 60 * 24)); let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); let seconds = Math.floor((distance % (1000 * 60)) / 1000); // Output the result in an element with id="demo" date.text(hours + ":" + minutes + ":" + seconds); // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("demo").innerHTML = "EXPIRED"; } else { setTimeout(function(){ timeGet(date, ints); }, 1000); } }
JavaScript Mia Gill, Apr 26, 2019 -
with Date.UTC
new Date(Date.UTC(year, month, day, hour, minute, second));
Anonymous -
If you work a lot with dates try https://momentjs.com/Fiona Garza
2 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!