# Date.getUTCHours()

The getUTCHours() method returns the hours in the specified date according to universal time.

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

console.log(date1.getUTCHours());
// expected output: 12

console.log(date2.getUTCHours());
// expected output: 10

```

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

```javascript
dateObj.getUTCHours()
```

**Return value**

An integer number, between 0 and 23, representing the hours in the given date according to universal time.

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

#### Using `getUTCHours()` <a href="#using_getutchours" id="using_getutchours"></a>

The following example assigns the hours portion of the current time to the variable `hours`.

```javascript
var today = new Date();
var hours = today.getUTCHours();
```

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

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

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

Uros Durdevic
