JavaScript Date getUTCDay() Method
- Previous Page getUTCDate()
- Next Page getUTCFullYear()
- Go Back to the Previous Level JavaScript Date Reference Manual
Definition and Usage
getUTCDay()
The method returns the day of the week for a specified date based on UTC (from 0 to 6).
Note:Sunday is 0, Monday is 1, and so on.
When calculating dates, the UTC method assumes that the date object is local time and date.
Tip:Coordinated Universal Time (UTC) is the standard time set by the world time standard.
Note:UTC time is the same as GMT time (Greenwich Mean Time).
Example
Example 1
Returns the day of the week based on UTC:
var d = new Date(); var n = d.getUTCDay();
Example 2
Returns the name of weekday (not just the number):
var d = new Date(); var weekday = new Array(); 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()];
Syntax
Date.getUTCDay()
Parameters
No parameters.
Technical Details
Return Value: | Numeric values, from 0 to 6, represent the day of the week. |
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
getUTCDay() | Support | Support | Support | Support | Support |
Related Pages
Tutorial:JavaScript Date
Tutorial:JavaScript Date Format
Tutorial:JavaScript Object Constructor
- Previous Page getUTCDate()
- Next Page getUTCFullYear()
- Go Back to the Previous Level JavaScript Date Reference Manual