JavaScript .getUTCDay()

AminaRadoni24's avatar
Published Jun 14, 2023Updated Jan 9, 2024

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.

  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours

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:

Code
Output

All contributors

Learn JavaScript on Codecademy

  • Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.
    • Beginner Friendly.
      15 hours