Date getUTCMonth() method with example in JavaScript

JavaScript Date getUTCMonth() method: Here, we are going to learn about the getUTCMonth() method of Date class with Example in JavaScript.
Submitted by IncludeHelp, on March 08, 2019

JavaScript Date getUTCMonth() method

getUTCMonth() method is a Date's class method and it is used to get the current month’s value according to the UTC (Universal time coordinated) between the range of 0 to 11, where 0 for January, 1 for February, ..., 11 for December.


    var dt = new Date();


    var dt = new Date();
    2 //if the month is March

JavaScript code to get the current UTC month's value using getUTCMonth() method

<head><title>JavaScipt Example</title></head>

	var dt = new Date(); //Date constructor 
	var month1 = dt.getUTCMonth(); //UTC Month
	var month2 = dt.getMonth(); //local Month
	//printing Milliseconds
	document.write("UTC Month = " + month1 + "<br>");
	document.write("Local Month = " + month2 + "<br>");


UTC Month = 2
Local Month = 2

Reference: JavaScript getUTCMonth() Method

JavaScript Date Object Methods »

All JavaScript Examples

Comments and Discussions!

Load comments ↻

Copyright © 2024 All rights reserved.