Calendar Example
Question: How do I determine the week day for a given date?
Answer:
To determine the week day for a given date,
you set this date in a Date()
object, and then
get the week day using the Date.getDay()
method:
d=new Date(); d.setDate(1);
d.setYear(yyyy);
d.setMonth(mm);
d.setDate(dd);
ww=d.getDay();
if (ww==0) wDay="Sunday";
if (ww==1) wDay="Monday";
if (ww==2) wDay="Tuesday";
if (ww==3) wDay="Wednesday";
if (ww==4) wDay="Thursday";
if (ww==5) wDay="Friday";
if (ww==6) wDay="Saturday";
JavaScripter.net.
Copyright
© 1999-2006, Alexei Kourbatov