August 1999
Intermediate to advanced
1488 pages
72h 53m
English
date.getMonth()
The getMonth() method returns the month portion of the Date object expressed as an integer from 0 (January) to 11 (December).
The code in Listing 6.77 displays the current month using the getMonth() method.
<html>
<script language="JavaScript">
<!-- Hide
//This function converts the month from a number to //a string and returns the string. function getMonthString(num) { var month; //Create a local variable to hold the string switch(num) { case 0: month="January"; break; case 1: month="February"; break; case 2: month="March"; break; ... |
Read now
Unlock full access