This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

getMonth

Summary

Gets the month, using local time.

Syntax

dateObj.getMonth()

Return Value

The getMonth method returns an integer between 0 (January) and 11 (December). For a Date constructed with "Jan 5, 1996", getMonth returns 0.

Examples

The following example shows how to use the getMonth method.

var date = new Date("1/1/2001");
 document.write(date.getMonth());

 // Output: 0

Remarks

The required dateObj reference is a Date object. To get the month value using Universal Coordinated Time (UTC), use the getUTCMonth method.

See also

Other articles

Attributions

  • Microsoft Developer Network: Article