get hour from date js code example
Example 1: javascript get 1 hour from now
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
}
Example 2: js date get hours
const birthday = new Date('March 13, 08 04:20');
console.log(birthday.getHours());
// expected output: 4