Date.setMonth() : setMonth « Date « JavaScript Tutorial






Syntax

date.setMonth(month)

The setMonth() method sets the month in the Date object to the argument month, an integer from 0 (January) to 11 (December).

The method returns an integer representing the number of milliseconds between midnight January 1, 1970 (GMT) to the new date.

<html>
    <script language="JavaScript">
    <!--
    theDate = new Date();

    document.write("Initial milliseconds=",theDate.getTime());
    document.write("<br>setMonth returned ");
    document.write(theDate.setMonth(2)," milliseconds.")
    document.write("<br>Final milliseconds=",theDate.getTime());
    -->
    </script>
    </html>








12.31.setMonth
12.31.1.Date.setMonth()