Date.getHours

getHours – Get the hour, according to local time (0–23).

Description

Date.getHours()

Return values

Integer

Examples

Example #1 – getHours example
var date = new Date(2015, 9, 21, 16, 29, 00); console.log(date.getHours()); // 16 console.log(new Date().getHours()); // Gets the current hour.

External references