JavaScript getUTCMonth Function

JavaScript getUTCMonth function is one of the Date Functions, which returns the Month Number on a given date according to universal time. Month Number starts from 0 (January) and ends at 11 (December). The syntax of the JavaScript getUTCMonth function is:

 Date.getUTCMonth()

JavaScript getUTCMonth Function Example

Here, we used the getUTCMonth function to return the month number as per the universal time from the current date and time.

<!DOCTYPE html>
<html>
<head>
    <title> JS </title>
</head>
<body>
    <h1> Example </h1>
<script>
  var dt = Date();  
  document.write("Date and Time : " + dt);
  document.write("UTC Month : " + dt.getUTCMonth());
</script>
</body>
</html>
Example

Date and Time: Mon Nov 05 2018 11:13:24 GMT+0530 (Indian Standard Time)
UTC Month : 10

getUTCMonth Example 2

In this JavaScript get UTC Month example, we display the month number from the custom date and time as per universal time.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScriptGetUTCMonthFunction </title>
</head>
<body>
    <h1> JavaScriptgetUTCMonthFunctionExample </h1>
<script>
  var dt = Date("April 1, 2017 10:12:22");
  document.write("Date and Time : " + dt);
  document.write("UTC Month using getUTCMonth : " + dt.getUTCMonth());
</script>
</body>
</html>
JavaScript getUTCMonth Example