Edrol97
Silver Coder
Hi all,
Got a page on my site that I want to display today's date on. Currently i have this code:
I don't think it's right because I've ran it and it doesn't display the date despite styling the class date. Does anyone know how I could implement this?
Got a page on my site that I want to display today's date on. Currently i have this code:
HTML:
<span class="date"></span>
<script>
const today = new Date();
const formattedDate = today.toDateString();
document.getElementById("date").textContent = formattedDate;
</script>
I don't think it's right because I've ran it and it doesn't display the date despite styling the class date. Does anyone know how I could implement this?