English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
getUTCHours()Returns the current hour (0-23)
getUTCHours()The returned value is from 0 to23integer.
World Standard Time (UTC) is the time standard set for world time.
date.getUTCHours()
var d = new Date(); d.getUTCHours();Test and See‹/›
All browsers fully support the getUTCHours() method:
Method | |||||
getUTCHours() | is | is | is | is | is |
Return Value: | from 0 to23are integers representing hours |
---|---|
JavaScript Version: | ECMAScript 1 |
Return the hour of a specific date and time:
var d = new Date(#39;August 20, 1999 23:15:30'); d.getUTCHours();Test and See‹/›
Use the getUTCHours(), getUTCMinutes(), and getUTCSeconds() methods to display the time:
setInterval(function () { var d = new Date(); var x = document.getElementById('result'); x.innerHTML = d.getUTCHours() + " + d.getUTCMinutes() + " + d.getUTCSeconds(); }, 1000);Test and See‹/›