getUTCHours()
Date
instance method
JS Home <<
JS Reference <<
Date <<
getUTCHours()
Description
Returns the UTC hour of the day (0-23) for the specified date.
Syntax
Signature | Description |
---|---|
aDate.getUTCHours() | Returns the UTC hour of the day (0-23) for the specified date. |
Parameters
None.
Examples
The code below shows an example of the getUTCHours()
method of Date
.
// Create a Date instance for the current date and time.
var todaysDate = new Date();
alert(todaysDate);
// Get UTC hour of the day.
alert(todaysDate.getUTCHours() + ' = Hour of the day');
Related Tutorials
JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times