CodesJava

Easy learning with example program codes

JavaScript setUTCHours() method

The JavaScript date setUTCHours() method sets the hour value for the 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>

Output:

6
12
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status