.getUTCDay()

Anonymous contributor's avatar
Anonymous contributor
Anonymous contributor's avatar
Anonymous contributor
Published Jun 14, 2023
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

All contributors

Looking to contribute?

Learn JavaScript on Codecademy