Description
The getHours() method returns the hour (from 0 to 23) of the specified date and time, according to local time.
This method has the form:
Date.getHours()
Examples
The following example shows the basic use of this method.
<script>
var d = new Date();
document.write(d.getHours());
</script>
This produces the following result:
Browser Support
Firefox | IE | Chrome | Opera | Safari |
---|---|---|---|---|