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
Recommended:-JavaScript Get Date Methods with Example
Recommended:-JavaScript Set Date Methods
Recommended:-JavaScript getUTCFullYear Method
Recommended:-JavaScript Functions Example Tutorial
Recommended:-JavaScript Anonymous Function
Recommended:-JavaScript Callback Functions with Example
Recommended:-JavaScript Arrow Function es6 Example
Recommended:-JavaScript Promise with Example
Recommended:-JavaScript: Object Properties
Recommended:-20+ JavaScript Array Methods
Recommended:-20 + JavaScript String Methods
Recommended:-JavaScript Find First Element Position In Array
Recommended:-JavaScript Check if an Array Contains a Value
Recommended:-JavaScript: Array every() method
Recommended:-JavaScript Array Reduce Method with Example
Recommended:-How to Use Array map() Method in JavaScript
Recommended:-JavaScript Array forEach – Loop Through an Array
Recommended:-JavaScript Convert Array to JSON Object
Recommended:-JavaScript Remove Duplicates From Array