JavaScript Tutorial/Date/getHours
Date.getHours()
The getHours() method returns the hour portion of the date expressed as an integer from 0 (12:00 a.m. midnight) to 23 (11:00 p.m.).
<html>
<head>
<title>Current Hour</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
var current_date = new Date();
hour_value = current_date.getHours();
document.write("The current hour is " + hour_value);
//-->
</script>
</body>
</html>