Here, we are getting a new date element, calling it d — lines 1-9.
We’re logging it to the console — line 11.
Then in lines 13-14, we’re inserting that variable directly into the HTML, using the function innerHTML in the element with the id of date.(That is, <span id="date"></span> that exist in the HTML is where the date is being inserted.)
Intro to JavaScript
Dates in JavaScript & Microseasons Demo
Part 1 of JS
var d = new Date().toLocaleString("en-US", {
timeZone: "America/New_York",
year: "numeric",
month: "long",
day: "numeric",
hour: "numeric",
minute: "numeric",
timeZoneName: "short"
});
console.log(d);
var date_element = document.getElementById("date");
date_element.innerHTML = d;