JavaScript setUTCHours()

The JavaScript date setUTCHours() method sets the hour value for a particular date on the basis of universal time.

Syntax:

dateObj.setUTCHours(new_hours);

Parameters: new_hours: Integer value between 0 to 23.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var today =new Date();
document.writeln(today.getUTCHours()+"<br>");
today.setUTCHours(12);
document.writeln(today.getUTCHours());
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com