Latest web development tutorials

JavaScript getUTCHours () method

Date Object Reference JavaScript Date Object

Examples

According to Universal Time (UTC) Returns the time in hours:

var d = new Date();
var n = d.getUTCHours();

n output:


try it"

Definition and Usage

getUTCHours () method according to Universal Time (UTC) Returns the hour of time.

Coordinated Universal Time (UTC) in seconds when the atomic length based on the time metering system as close as possible in a time when the world.

Tip: Coordinated Universal Time, also known as the unified world time, Universal Time, Coordinated Universal Time, abbreviated UTC (Universal Coordinated Time).

Note: UTC time is the GMT (Greenwich Mean) time.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support getUTCHours () method


grammar

Date.getUTCHours()

return value

类型 描述
Number 该值是一个 0(午夜) ~ 23(晚上 11 点) 之间的整数。

technical details

JavaScript version: 1.3


More examples

Examples

Here, we will extract a specific date and time in UTC hours:

var d=new Date("July 21, 1983 01:15:00");
var n=d.getUTCHours();

n output


try it"

Examples s

Displays the current UTC time
How getUTCHours (), getUTCMinutes () and getUTCSeconds () to display the current UTC time.


Date Object Reference JavaScript Date Object