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
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.
document.write(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][myDate.getDay()]);
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();
myDate.setDate(myDate.getDate()+7);
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);
//-->
</script>