The JavaScript date getUTCHours() method is used to get the integer value between 0 and 23 that represents the hours on the basis of universal time.
Syntax:
dateObj.getUTCHours()
Return:
An integer value between 0 and 23.
Example:
<!DOCTYPE html> <html> <body> <script> var today = new Date(); document.writeln(today.getUTCHours()); </script> </body> </html>