JavaScript getUTCDay()
Method
Example
Returns a number representing the day of the week:
n Output result:
Definition and Usage
The getUTCDay()
method returns a number representing the day of the week according to Coordinated Universal Time (UTC).
Note: Sunday is 0, Monday is 1, and so on.
Coordinated Universal Time (UTC) is a time standard based on atomic time, closely approximating Universal Time.
Tip: Coordinated Universal Time, also known as Universal Coordinated Time, World Standard Time, and International Coordinated Time, is abbreviated as UTC.
Note: UTC time is equivalent to GMT (Greenwich Mean Time).
Browser Support
All major browsers support the getUTCDay()
method.
Syntax
Return Value
Type | Description |
---|---|
Number | The value is between 0 (Sunday) and 6 (Saturday). |
Technical Details
| JavaScript Version: | 1.3 | | --- | --- |
More Examples
Example
Now, I will create an array so that the above example can output the name of the day of the week, not just a number:
n Output result: