Try out this. If you want it in the format of Weekday Month Day Year
remove the .slice(0, -5);
on date
.
There is plenty of documentation online. You have to look.
Read more about toDateString()
here.
Read more about .slice()
here.
var newDt = new Date();
newDt.setDate(newDt.getDate() + 5);
var date = newDt.toDateString();
document.writeln("" + date.slice(0, -5));
To make it in the format you want, Weekday Day Month
use this example.
var date = new Date();
var locale = "en-us";
var weekdayNumber = date.toLocaleString(locale, { weekday: "short"});
var calenderDay = date.getDate();
var month = date.toLocaleString(locale, { month: "short" });
document.writeln(weekdayNumber + " " + calenderDay + "th " + month);
Be careful with dates like the 1st
and 2nd
or anything other than th