The getUTCMonth() method returns an integer number, between 0 (January) and 11 (December), corresponding to the month of the given date according to universal time.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display UTC month of the current date.</p>
<buttononclick="myFunction()">Display UTC Month</button>
<pid="point"></p>
<script>
functionmyFunction() {
vard=newDate();
varn=d.getUTCMonth();
document.getElementById("point").innerHTML=n;
}
</script>
</body>
</html>
In the following example, we will get the UTC month from a specific date.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display UTC month of the given date.</p>
<buttononclick="myFunction()">Display UTC Month</button>
<pid="point"></p>
<script>
functionmyFunction() {
vard=newDate("May 19, 1995 02:30:25");
varn=d.getUTCMonth();
document.getElementById("point").innerHTML=n;
}
</script>
</body>
</html>