--- title: Date.prototype.getUTCHours() slug: Web/JavaScript/Referencia/Objetos_globales/Date/getUTCHours translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCHours ---
{{JSRef}}

El método getUTCHours() retorna las horas especificadas en la fecha deacuerdo al horario universal.

Syntax

dateObj.getUTCHours()

Return value

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

Examples

Using getUTCHours()

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

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

Specifications

Specification Status Comment
{{SpecName('ES1')}} {{Spec2('ES1')}} Initial definition. Implemented in JavaScript 1.3.
{{SpecName('ES5.1', '#sec-15.9.5.19', 'Date.prototype.getUTCHours')}} {{Spec2('ES5.1')}}  
{{SpecName('ES6', '#sec-date.prototype.getutchours', 'Date.prototype.getUTCHours')}} {{Spec2('ES6')}}  
{{SpecName('ESDraft', '#sec-date.prototype.getutchours', 'Date.prototype.getUTCHours')}} {{Spec2('ESDraft')}}  

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

See also