The JavaScript date setHours() method sets the hour value for a particular date on the basis of local time.
Syntax:
dateObj.setHours(new_Hours);
Parameters:
new_Hours: Integer value between 0 to 23.
Example:
<!DOCTYPE html> <html> <body> <script> var bday =new Date("November 16, 1994 21:00:10"); document.writeln(bday.getHours() + "<br>"); bday.setHours(12); document.writeln(bday.getHours()); </script> </body> </html>