Javascript examples for Date:getDay
The getDay() method returns the day of the week (from 0 to 6) for the specified date.
Sunday is 0, Monday is 1, and so on.
None
A Number, from 0 to 6, representing the day of the week
The following code shows how to return the day of the week:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w ww. ja v a 2s . c om*/ var d = new Date(); var n = d.getDay() document.getElementById("demo").innerHTML = n; } </script> </body> </html>