PDA

View Full Version : Week Day - But not todays


spc197
12-29-2001, 08:25 AM
I have been on the search for some time with no avail.

I am trying to take a value from my <select> statement into my javascript and find out what weekday it is.

I have managed to get the value into the script but I have been unable to get the script to recognise it as a date and to tell me what week day it is.

mighty_muke
12-29-2001, 01:47 PM
Do you have an example of the code??
MM.

COBOLdinosaur
12-29-2001, 07:55 PM
Assuming the date you capture is valid then:

var yourdate= newDate{datefromselect};
var nday=yourdate.getDay();
switch (nday)
{
case 0 : nday="Sunday";
break;
case 1 : nday="Monday";
break;
case 2 : nday="Tuesday";
break;
case 3 : nday="Wednesday";
break;
case 4 : nday="Thursday";
break;
case 5 : nday="Friday";
break;
case 6 : nday="Saturday";
break;
}