This article has shared with you four methods of the current date of the week for your reference. The specific content is as follows
Method 1:
// The calculation system is currently the day of the week var str = "Today is the day of the week" + "Day one, two, three, four, five, six".charat(new date().getday());
Method 2:
var a = new array("day", "one", "two", "three", "four", "five", "six");var week = new date().getday();var str = "Today is the week" + a[week];alert(str);Method 3:
var str = "Today is the week";var week = new date().getday(); switch (week) { case 0 : str1 += "day"; break; case 1 : str1 += "one"; break; case 2 : str1 += "two"; break; case 3 : str1 += "three"; break; case 4 : str1 += "four"; break; case 5 : str1 += "five"; break; case 6 : str1 += "six"; break;}alert(str);Method 4:
var str = "";var week = new date().getday();if (week == 0) { str = "Today is Sunday";} else if (week == 1) { str = "Today is Monday";} else if (week == 2) { str = "Today is Tuesday";} else if (week == 3) { str = "Today is Wednesday";} else if (week == 4) { str = "Today is Thursday";} else if (week == 5) { str = "Today is Friday";} else if (week == 6) { str = "Today is Saturday";}alert(str);The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.