From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript Date Object
The getDay() method returns a number that represents the day of the week.
| dateObject.getDay() |
Note: The value returned by getDay() is a number between 0 and 6. Sunday is 0, Monday is 1 and so on.
Note: This method is always used in conjunction with a Date object.
Example 1Get the current day (as a number) of the week:
The output of the code above will be: Try it yourself » |
Example 2Now we will create an array to get our example to write a weekday, and not just a number:
The output of the code above will be: Try it yourself » |
JavaScript Date Object
From http://www.w3schools.com (Copyright Refsnes Data)