The getUTCHours()
method returns the hours in the specified date according to universal time.
dateObj.getUTCHours()
None.
The value returned by getUTCHours()
is an integer between 0 and 23.
getUTCHours()
The following example assigns the hours portion of the current time to the variable hours
.
var today = new Date(); var hours = today.getUTCHours();
Created by Mozilla Contributors and licensed under CC-BY-SA 2.5