.getUTCDay()
Published Jun 14, 2023Updated Jan 9, 2024
Contribute to Docs
The .getUTCDay()
method returns the day of the week in the specified date according to universal time, as an integer value from 0 - 6 where 0 represents Sunday, 1 for Monday and so on.
Syntax
date_obj.getUTCDay();
The return value will give return an integer between 0 and 6:
- 0 = Sunday
- 1 = Monday
- 2 = Tuesday
- 3 = Wednesday
- 4 = Thursday
- 5 = Friday
- 6 = Saturday
Example
The following example shows the method in use.
const date = new Date('10 June 2023 14:15:30');console.log(date.getUTCDay());
This will result in the following output:
6
Codebyte Example
The example below returns the day of the week according to the universal time, where 0 represents Sunday. The value returned will be an integer between 0 and 6:
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.