May 2001
Intermediate to advanced
720 pages
23h 24m
English
Date.getMonth( ) Method — the month of the year
Flash 5
date.getMonth( )
An integer from 0
(January) to 11 (December), not 1 to 12, representing the month of
the year of date.
Be careful not to assume that 1 is January! The return value of
getMonth( ) starts at 0, not 1.
Here we convert the number returned by getMonth(
) to a human-readable abbreviation:
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];
myDateObj = new Date( );
trace ("The month is " + months[myDateObj.getMonth( )]);Read now
Unlock full access