Home >>JavaScript Date Object Methods >JavaScript getUTCMonth() Method

JavaScript getUTCMonth() Method

JavaScript getUTCMonth() Method

The getUTCMonth() method method in JavaScript returns the month (from 0 to 11) in the specified date according to universal time. The value returned by getUTCMonth() is an integer between 0 to 11 [January is 0, February is 1, and so on].

Syntax:
Date.getUTCMonth()

Browser Support

Method Chrome Edge Firefox Safari Opera
getUTCMonth() Yes Yes Yes Yes Yes
Here is an example of JavaScript getUTCMonth() Method:
<html>
<body>
<button onclick="mygetmonth()">click me</button>
<p id="month"></p>
<script>
function mygetmonth() 
{
  var d = new Date();
  var z = d.getUTCMonth();
  document.getElementById("month").innerHTML = z;
}
</script>
</body>
</html>
Output:

Example 2:
<html>
<body>
<script> 
var dateobj = new Date('July 5, 1997 22:02:25 GMT+11:00'); 
var M = dateobj.getUTCMonth();  
document.write(M); 
</script> 
</body>
</html>
Output:

No Sidebar ads