JavaScript Code


JavaScript – Get Hours from Date


Date – getHours()

date.getHours()

getHours() returns the hours of this date object

Examples

1. get the hours from current date

let date = new Date();
console.log(date);
console.log(date.getHours());


Copyright @2022