# Date.getUTCDay()

The getUTCDay() method returns the day of the week in the specified date according to universal time, where 0 represents Sunday.

```javascript
var date1 = new Date('August 19, 1975 23:15:30 GMT+11:00');
var date2 = new Date('August 19, 1975 23:15:30 GMT-11:00');

// Tuesday
console.log(date1.getUTCDay());
// expected output: 2

// Wednesday
console.log(date2.getUTCDay());
// expected output: 3

```

## Syntax <a href="#syntax" id="syntax"></a>

```javascript
dateObj.getUTCDay()
```

**Return value**

An integer number corresponding to the day of the week for the given date, according to universal time: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.

## Examples <a href="#examples" id="examples"></a>

#### Using `getUTCDay()` <a href="#using_getutcday" id="using_getutcday"></a>

The following example assigns the weekday portion of the current date to the variable `weekday`.

```javascript
var today = new Date();
var weekday = today.getUTCDay();
```

## References <a href="#references" id="references"></a>

{% embed url="<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getUTCDay>" %}

## Contributors to this page <a href="#contributors-to-this-page" id="contributors-to-this-page"></a>

Uros Durdevic
