[This question is different from other JS Date questions because it focuses on extending the default 3-character limit in the Date function.]
I have created a JavaScript new Date
function for HTML5. The Date
function retrieves the current date each time the page is loaded. I need the day of the month (16) before the month (February). I also need the date to display the full length of characters for the date (Saturday, February) instead of the first three characters of the date (Sat, Feb).
In my HTML document, the date currently looks like this:
Sat Feb 16 2019
This is my current JS script:
var d = new Date();
document.getElementById("date").innerHTML = d.toDateString();
I need the date to display all of the characters for the weekday and month.
I need the date to look like this:
Saturday, 16 February 2019
I am still new to JavaScript, so any help or advice is appreciated.