JavaScript - Date getUTCHours() Method


Advertisements


Description

Javascript date getUTCHours() method returns the hours in the specified date according to universal time. The value returned by getUTCHours() is an integer between 0 and 23.

Syntax

Its syntax is as follows −

Date.getUTCHours ()

Return Value

Returns the hours in the specified date according to universal time.

Example

Try the following example.

<html>
   <head>
      <title>JavaScript getUTCHours Method</title>
   </head>
   
   <body>
   
      <script type="text/javascript">
         var dt = new Date();
         document.write("getUTCHours() : " + dt.getUTCHours() ); 
      </script>
      
   </body>
</html>

Output

getUTCHours() : 11 

javascript_arrays_object.htm

Advertisements