Display day of the week with Javascript date

I am using the code below to display a date 7 days in the future. However this javascript code formats the date by mm/dd/yyyy.

I would like to modify the javascript code below to have it display the day of the week instead such as Friday, Nov 1

I do not need it to display the year.

Any help would be much appreciated as I am stumped.

var myDate=new Date();
var n=myDate.toLocaleDateString();



try this , adding 1 week from current day output you get is :Friday,November 1

<script >

var m_names = ["January", "February", "March", 
"April", "May", "June", "July", "August", "September", 
"October", "November", "December"];

var d_names = ["Sunday","Monday", "Tuesday", "Wednesday", 
"Thursday", "Friday", "Saturday"];

var myDate = new Date();
var curr_date = myDate.getDate();
var curr_month = myDate.getMonth();
var curr_day  = myDate.getDay();
document.write(d_names[curr_day] + "," + m_names[curr_month] + " " +curr_date);


Date has a getDay() method which returns a day number, starting with Sunday on 0 and continuing with Monday=1, Tuesday=2 and so on.

You can use that to return just the week day. See How to get the day from a particular date using JavaScript and similar questions.



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.