--- title: Date.prototype.getUTCHours() slug: Web/JavaScript/Reference/Global_Objects/Date/getUTCHours tags: - Date - JavaScript - Prototipo - Prototype - Referencia - metodo translation_of: Web/JavaScript/Reference/Global_Objects/Date/getUTCHours ---
getUTCHours() retorna o número de horas na data especificada de acordo com o horário universal (UTC).{{EmbedInteractiveExample("pages/js/date-getutchours.html")}}
dateObj.getUTCHours()
Um número inteiro, entre 0 e 23, representando as horas em uma data de acordo com o horário universal (UTC).
getUTCHours()O exemplo a seguir atribui a porção de horas do horário corrente à variável hours.
var today = new Date(); var hours = today.getUTCHours();
| Especificação |
|---|
| {{SpecName('ESDraft', '#sec-date.prototype.getutchours', 'Date.prototype.getUTCHours')}} |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("javascript.builtins.Date.getUTCHours")}}