> How do i show the current date in javascript?

How do i show the current date in javascript?

Posted at: 2014-12-18 
function showDate() {

????var d = new Date();

????var options = {weekday: "long", year: "numeric", month: "long", day: "numeric"};

????return d.toLocaleString("en-US", options);

}

Hi There,

this might help: Al







The setDate() method sets the date of a month.











I need to display today's date on a website in javascript and it needs to update automatically everyday. Like "October 24, 2014". I'm new to JS and I have this code i'm supposed to use but i'm lost. If i plug it into a web page, nothing shows up. What am i missing?

function showDate() {

thisDate = new Date();

var thisWDay=thisDate.getDay();

var thisDay=thisDate.getDate();

var thisMonth=thisDate.getMonth();

var thisYear=thisDate.getFullYear();

var mName = new Array("January", "February", "March", "April", "May",

"June", "July", "August", "September", "October","November", "December");

var wdName = new Array("Sunday", "Monday", "Tuesday", "Wednesday",

"Thursday", "Friday", "Saturday");

return wdName[thisWDay]+", "+mName[thisMonth]+" "+thisDay+", "+thisYear;

}

function dayNumber() {

thisDate = new Date();

var leapYearDate = thisDate.setFullYear(2004);

var baseDate = new Date("January 1, 2004");

days = Math.floor((leapYearDate - baseDate)/(1000*60*60*24)+1);

return days;

}