JavaScript Date getUTCMonth()
Examples
Get the month, according to universal time:
const d = new Date();
let month = d.getUTCMonth();
Try it Yourself »
Get the name of the month (not just a number):
const month = ["January","February","March","April","May","June","July","August","September","October","November","December"];
const d = new Date()
let month = month[d.getUTCMonth()];
Try it Yourself »
Description
getUTCMonth()
returns the month (0 to 11) of a date.
getUTCMonth()
returns the month according to UTC.
January = 0, February = 1, ... (See below):
Notes
UTC (Universal Time Coordinated) is the time set by the World Time Standard.
UTC time is the same as GMT time (Greenwich Mean Time).
All JavaScript getUTC methods assume that the date is of local time.
Syntax
Date.getUTCMonth()
Parameters
NONE |
Return Value
Type | Description |
A number | The month of the date (0 to 11). |
Browser Support
getUTCMonth()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |