javaScript date.getUTCmonth Method with Examples

JavaScript Date.getUTCMonth() method; Through this tutorial, i am going to show you how to get UTC month in javascript using date.getUTCmonth() method with the help of examples.

JavaScript: Date.getUTCMonth() Method

  • Date.getUTCMonth() Method
  • Syntax of JavaScript: Date.getUTCMonth() Method
  • Example of JavaScript Date.getUTCMonth() Method

Date.getUTCMonth() Method

Javascript date getUTCMonth() method is used to get the month for the specified date according to universal time. The getUTCMonth method will return an integer value between 0 and 11.

Syntax of JavaScript: Date.getUTCMonth() Method

The syntax is date.getUTCMonth method is:

 Date.getUTCMonth()

Note: January is 0, February is 1, and so on.

Example of JavaScript Date.getUTCMonth() Method

Using the javascript getUTCMonth() method, you can get utc month in javaScript; as shown below:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JavaScript date.getUTCMonth Method</title>
</head>
<body>
  <script type = "text/javascript">
     var currentDate = new Date();
     document.write("the javascript date.getUTCMonth() : " + currentDate.getUTCMonth() ); 
  </script>  
</body>
</html>

Result of the above code is

the javascript date.getUTCMonth() : 11

Conclusion

In this javascript tutorial, you have learned how to get a month using getUTCMonth function with example.

More JavaScript Tutorials

Leave a Comment