ES6 - getHours() Method



JavaScript Date getHours() method returns the hour in the specified date according to local time. The value returned by getHours is an integer between 0 and 23.

Syntax

Date.getHours()   

Return Value

Returns the hour in the specified date according to local time.

Example

var dt = new Date("December 25, 1995 23:15:00"); 
console.log("getHours() : " + dt.getHours());   

Output

getHours() : 23
Advertisements