JavaScript getUTCMonth()Method
Examples
Returns the month according to universal time UTC:
var n = d.getUTCMonth();
nOutput:
Try it Yourself »
Definition and Usage
The getUTCMonth() method returns a number representing the month (according to universal time UTC).
Note:January is 0, February is 1, and so on.
Coordinated Universal Time (UTC) is a time measurement system based on the atomic second, which is as close as possible to universal time in terms of the instant of time.
Tip:Coordinated Universal Time, also known as Universal Time Coordinated, World Standard Time, International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).
Note:UTC time is the same as GMT (Greenwich) time.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the getUTCMonth() method
Syntax
Return Value
| Type | Description |
|---|---|
| Number | , the value is an integer between 0 (January) and 11 (December). |
Technical Details
| JavaScript Version: | 1.3 |
|---|
More Examples
Examples
Now, we will create an array so that the example above can output the name of the month, not just a number:
var month=new Array(12);
month[0]="January";
month[1]="February";
month[2]="March";
month[3]="April";
month[4]="May";
month[5]="June";
month[6]="July";
month[7]="August";
month[8]="September";
month[9]="October";
month[10]="November";
month[11]="December";
var n = month[d.getUTCMonth()];
nOutput:
Try it Yourself »
Other Extensions
JavaScript Date Object