Javascript Date getUTCDay()
returns the UTC date's day of the week as a number (where 0 represents Sunday and 6 represents Saturday).
An integer number corresponding to the day of the week for the given date, according to universal time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.
var today = new Date(); var weekday = today.getUTCDay(); console.log(weekday);// w w w. jav a 2 s . c om
Return the name of the weekday:
var d = new Date(); var weekday = new Array(7); weekday[0] = "Sunday"; weekday[1] = "Monday"; weekday[2] = "Tuesday"; weekday[3] = "Wednesday"; weekday[4] = "Thursday"; weekday[5] = "Friday"; weekday[6] = "Saturday"; var n = weekday[d.getUTCDay()]; console.log(n);/*from w ww . j ava 2 s. c o m*/