getHours()

The getHours() method is used to return the hour of the day, which is the taken from the date specified by your operating system, and used by the Date object. The hour returned is based on the 24 hour clock system.

syntax:

dateName.getHours()

EXAMPLE

dateObject = new Date();

document.write("The date is: " + dateObject.getHours());

The example shows the creation of a new Date object, called dateObject. It is then used within a document.write statement, with the getHours() method to display number of hours within this day of the week after the string of text.