getHours() technique will gives back the hour (from 0 to 23) of the predetermined date and time. By utilizing these two techniques setHours() and getHours(), you can without much of a stretch add hours to Date object.
Pass the hours as a parameter in
addHours() function which you want to add to the Date object. See below example add 3 hours to current date.
Now you’ll see 3 hours will be added in current date.