Return the month, according to universal time:
let month = d.getUTCMonth();
More "Try it Yourself" examples below.
Definition and Usage
The getUTCMonth() method returns the month (from 0 to 11) of a date object, according to UTC.
Note: January is 0, February is 1, and so on.
UTC time (Coordinated Universal Time) is the time set by the World Time Standard.
UTC time is the same as GMT time (Greenwich Mean Time).
All getUTC methods assume that the date object is of local time and date.
It is fully supported in all browsers:
|Return Value:||A Number, from 0-11, representing the month|
Return the name of the month, according to universal time (not just a number):
month = "January";
month = "February";
month = "March";
month = "April";
month = "May";
month = "June";
month = "July";
month = "August";
month = "September";
month = "October";
month = "November";
month = "December";
const d = new Date()
let month = month[d.getUTCMonth()];