B
Bill Edwards
Sorry for forgetting to post my code yesterday, the bit that works is
similar to something I last in here last week
var now = new Date();
var dayNames = new
Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
var monNames = new
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
alert("Today is: " + dayNames[now.getDay()] + " " +
monNames[now.getMonth()] + " " + now.getDate());
I saw the below code on a site for working out workdays (Mon thru Fri)
but I can't get it to work with the above, some expected ";" error.
function weekend();
{
startDate = new Date();
if(startDate.getDay() == 7){
startDate.setDate( startDate.getDate() - 1);
}
else {
if(startDate.getDay() == 1){
startDate.setDate( startDate.getDate() - 2);
}
}
return startDate;
}
I'd like all Saturdays and Sundays to return Friday's date so that I
can change the alert text to "The current or last workday is:" Is this
possible? I'm making this far too complicated aren't I?
similar to something I last in here last week
var now = new Date();
var dayNames = new
Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
var monNames = new
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
alert("Today is: " + dayNames[now.getDay()] + " " +
monNames[now.getMonth()] + " " + now.getDate());
I saw the below code on a site for working out workdays (Mon thru Fri)
but I can't get it to work with the above, some expected ";" error.
function weekend();
{
startDate = new Date();
if(startDate.getDay() == 7){
startDate.setDate( startDate.getDate() - 1);
}
else {
if(startDate.getDay() == 1){
startDate.setDate( startDate.getDate() - 2);
}
}
return startDate;
}
I'd like all Saturdays and Sundays to return Friday's date so that I
can change the alert text to "The current or last workday is:" Is this
possible? I'm making this far too complicated aren't I?