Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:Date:getMonth

From MDC


Contents

[edit] Summary

Returns the month in the specified date according to local time.

Method of Date
Implemented in: JavaScript 1.0, NES 2.0
ECMA Version: ECMA-262

[edit] Syntax

getMonth()

[edit] Parameters

None.

[edit] Description

The value returned by getMonth is an integer between 0 and 11. 0 corresponds to January, 1 to February, and so on.

[edit] Examples

[edit] Example: Using getMonth

The second statement below assigns the value 11 to the variable month, based on the value of the Date object Xmas95.

Xmas95 = new Date("December 25, 1995 23:15:00")
month = Xmas95.getMonth() 

[edit] See Also

getUTCMonth, setMonth