JavaScript getUTCMonth

The JavaScript getUTCMonth function returns the Month Number between 0 and 11 from a given date according to Universal Coordinated Time (UTC). The month number starts from 0 (January) and ends at 11 (December).

The syntax of the getUTCMonth function is:

 Date.getUTCMonth()

Return Value: The getUTCMonth() method returns an integer between 0 and 11 representing the month from a given date. As it follows the 0-based indexing, January is set to 0, February is set to 1, and December is set to 11.

JavaScript getUTCMonth example

In the following example, we used the getUTCMonth() function to return the month number as per the universal time from the current date and time.

const dt = new Date();
let m = dt.getUTCMonth();
console.log(m);
console.log(dt);
5 
Sat Jun 13 2026 13:25:25 GMT+0530 (India Standard Time)

Example 2:  Use getUTCMonth on a string date

In this JavaScript example, we use the Date() constructor to parse a string date. Next, the getUTCMonth() method displays the month number from the custom date and time as per universal time.

const dt = new Date("April 1, 2023 10:12:22");
console.log(dt.getMonth());
3

Example 3: If we use the JavaScript getUTCMonth() function on a string date without a month value, it returns 0 as the output. If you pass the year only, it considers the Month as January and the day as 1st of January. So, the getUTCMonth() method returns 0 = January.

const dt = new Date("2023");
console.log(dt.getMonth());
console.log(dt);
0 
Sun Jan 01 2023 05:30:00 GMT+0530 (India Standard Time)

Example 4: getUTCMonth returns NaN

If we use the getUTCMonth method on an invalid date, it returns NaN as output. In the following example, we specified the day value as 40, which is an invalid date.

const dt = new Date("April 40, 2023");
console.log(dt.getMonth());
console.log(dt);
NaN 
Invalid Date

Why does JavaScript getUTCMonth() return the wrong month?

Many people confuse the getUTCMonth() result and consider it to be returning the wrong month. However, it is designed in such a way that the first month number is 0 (January = 0). If January is 0, then June means 5.

const dt = new Date();
console.log(dt.getUTCMonth());
console.log(dt);
5 
Sat Jun 13 2026 13:31:13 GMT+0530 (India Standard Time)

If you are particular about the numbers, use the arithmetic + operator to add 1 to it.

const dt = new Date();
console.log(dt.getUTCMonth() + 1);
6

JavaScript get month in words

By default, the JavaScript getUTCMonth() returns an integer (0 -11), and to print the month name, there are two options. Either use an array of Month names and call it by index position (already explained in the getMonth() article).

In the example below, we use the toLocaleString() method with the month and timeZone attributes to get the month in words.

const dt = new Date();
console.log(dt.getMonth());
const name = dt.toLocaleString('en-US', { month: 'long', timeZone: 'UTC' });
console.log(name);
5 
June

Difference between getMonth() and getUTCMonth() in JavaScript

Both getMonth() and getUTCMonth() return the month number from 0 to 11.

  • getMonth(): It returns the month number from a given date according to the system’s local time zone.
  • getUTCMonth(): It returns the month number from a given date according to the Universal Coordinated Time zone.

In the example below, the getUTCMonth() returns 0 (January) according to Universal Coordinated Time. However, the getMonth() returns 11 (December) because the local system time zone is 10 hours behind UTC.

const dt = new Date("2026-01-01");
console.log(dt.getMonth());
console.log(dt.getUTCMonth());
console.log(dt);
11 
0 
Wed Dec 31 2025 14:00:00 GMT-1000 (Hawaii-Aleutian Standard Time)