Date.getMonth( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Date.getMonth( ) Method Flash 5

the month of the year
date.getMonth()

Returns

An integer from 0 (January) to 11 (December), not 1 to 12, representing the month of the year of date.

Usage

Be careful not to assume that 1 is January! The return value of getMonth( ) starts at 0, not 1.

Example

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()]);


    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net