.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.
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
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:
- Anonymous contributorAnonymous contributor1 total contribution
- Anonymous contributor