Copyright © tutorialspoint.com

Javascript Date getUTCMonth() Method

previous next

Advertisements


Description:

Javascript date getUTCMonth() method returns the month in the specified date according to universal time. The value returned by getUTCMonth is an integer between 0 and 11 corresponding to the month. 0 for January, 1 for February, 2 for March, and so on.

Syntax:

Date.getUTCMonth()

Here is the detail of parameters:

Return Value:

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

Example:

The following example prints the month portion of the current time to the variable hrs.

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

This will produce following result:

getUTCMonth() : 7 

To understand it in better way you can Try it yourself.


previous next

Copyright © tutorialspoint.com