August 1999
Intermediate to advanced
1488 pages
72h 53m
English
date.getDay()
The getDay() method returns the day of the week expressed as an integer from 0 (Sunday) to 6 (Saturday).
The code in Listing 6.72 uses the getDay() method to return the day of the week expressed as an integer. This number is then converted to a string representation of the day of the week.
<html> <script language="JavaScript"> <!-- Hide //This function converts the day from a number to //a string and returns the string. function getDayString(num) { var day; //Create a local variable to hold the string switch(num) { case 0: day="Sunday"; ... |
Read now
Unlock full access