+ 1
how do I print the current day of the week e.g. Monday
when I do this: var d = new Date(); d1 = d.getDay(); document.write(d1); I get the day of the week in number form( using zero notation with sunday = 0).
3 Antworten
+ 2
In JS you will get the result by number only. So here take a manual array of days.. it's simple.
var d = new Date();
var i = d.getDay();
var days =["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var daysName = days [i];
document.write(daysName);
0
I know this method of using an array. I was actually looking for an inbuilt JS Date() method. Thanks though.
- 2
No, there is no such way to get this.