76
JavaScript Date getUTCHours() method
The JavaScript date getUTCHours() method returns the hour for the specified date on the basis of universal time.
Syntax
The getUTCHours()method is represented by the following syntax:
Return
An integer value between 0 and 23 that represents the hour.
JavaScript Date getUTCHours() method example
Here, we will understand getUTCHours() method through various examples.
Example 1
Let’s see an example to print the value of current hour according to universal time.
Output:
Hour value : 12
Example 2
Let’s see an example to print the value of hour from the given date according to universal time.
Output:
Hour value1 : 11 Hour value2 : 9
Next TopicJavaScript Date