Return the hour, according to local time:
The result of n will be:
The getHours() method returns the hour (from 0 to 23) of the specified date and time.
![]()
The getHours() method is supported in all major browsers.
| Type | Description |
|---|---|
| Number | A Number, from 0 to 23, representing the hour |
| JavaScript Version: | 1.0 |
|---|
Return the hour from a specific date and time:
The result of n will be:
Display the time
How to use getHours(), getMinutes(), and getSeconds() to display the time.
JavaScript Date Object
Your message has been sent to W3Schools.