JavaScript getUTCMonth () method
Examples
Based on Universal Time UTC, Returns the month:
var d = new Date();
var n = d.getUTCMonth();
var n = d.getUTCMonth();
n output:
try it"
Definition and Usage
getUTCMonth () method returns a numeric representation of the month (when the World UTC).
Note: January is 0, February is 1, and so on.
Coordinated Universal Time (UTC) in seconds when the atomic length based on the time metering system as close as possible in a time when the world.
Tip: Coordinated Universal Time, also known as the unified world time, Universal Time, Coordinated Universal Time, abbreviated UTC (Universal Coordinated Time).
Note: UTC time is the GMT (Greenwich Mean) time.
Browser Support
All major browsers support getUTCMonth () method
grammar
Date.getUTCMonth()
return value
类型 | 描述 |
---|---|
Number | ,该值是 0(一月) ~ 11(十二月) 之间中的一个整数。 |
technical details
JavaScript version: | 1.3 |
---|
More examples
Examples
Now, we will create an array, so that our example above is capable of outputting the month name, not just a number:
var d=new Date()
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()];
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()];
n output:
try it"