How to use getUTCMonth in JavaScript
In this article, I will explain use of getUTCMonth() method in JavaScript date object.
JavaScript date getUTCMonth() method
-
getUTCMonth() method of date object returns the month in the specified date according to UTC.
-
In getUTCMonth() method, The returned value is an integer number between 0 and 11. just like January is 0, February is 1, and so on.
-
Universal Coordinated Time is the time set by the World Time Standard.
Syntax
Example
In the following example show to getUTCMonth() method returns current month according to universal time.
<!DOCTYPE html>
<html>
<body>
<h3 style="color:ActiveCaption">JavaScript getUTCMonth() Method Example</h3>
<p id="demo">Click to display the month, according to UTC.</p>
<button onclick="myFunction()">click Me</button>
<script type="text/javascript">
function myFunction() {
var d = new Date();
var x = document.getElementById("demo");
x.innerHTML = document.write("According to UTC, Current Month is: " + d.getUTCMonth());
}
</script>
</body>
</html>
|
Output1

Output2

You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here