JavaScript Date getUTCMonth() Method
- Previous Page getUTCMinutes()
- Next Page getUTCSeconds()
- Go to the Previous Level JavaScript Date Reference Manual
Definition and Usage
getUTCMonth()
The method returns the month of the specified date according to the universal time (from 0 to 11).
Note: January is 0, February is 1, and so on.
When calculating dates, the UTC method assumes that the date object is local time and date.
Tip:Coordinated Universal Time (UTC) is the standard time set by the world time standard.
Note:UTC time is the same as GMT time (Greenwich Mean Time).
Example
Example 1
Returns the month in UTC:
var d = new Date(); var n = d.getUTCMonth();
Example 3
Returns the name of the month in UTC (not just the 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()];
Syntax
Date.getUTCMonth()
Parameter
No parameters.
Technical Details
Return Value: | Numeric value, from 0 to 11, representing the month. |
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
getUTCMonth() | Support | Support | Support | Support | Support |
Related Pages
Tutorial:JavaScript Date
Tutorial:JavaScript Date Format
Tutorial:JavaScript Object Constructor
- Previous Page getUTCMinutes()
- Next Page getUTCSeconds()
- Go to the Previous Level JavaScript Date Reference Manual