Forum Moderators: open
The code is below. It works on most days of the week, except the skip from Saturday to Sunday.
I have to somehow tell it to loop the days of the week.
So on Fridays, the 2 day skip won't work, and it just writes "undefined". All the other days of the week work fine though.
<script language="JavaScript">
<!--
var now = new Date();
var days = new Array(
'Sunday','Monday','Tuesday',
'Wednesday','Thursday','Friday','Saturday');
var months = new Array(
'January','February','March','April','May',
'June','July','August','September','October',
'November','December');
var date = now.getDate()+2;
today = days[now.getDay()+2] + ", " +
months[now.getMonth()] + " " +
date;
//-->
</script><script type="text/javascript">document.write(today);</script>
To add/subtract dayes, you have to do it on the Date object itself, not on the functions that return the data. In your existing code, you'll also have a problem when you are one day from the end of the month (because you'll end up displaying the current month no matter what right now.
But, like I said, you're practically there in the code with your definition of the date variable, the trick is to define that properly and then use it when you output the day and month:
<script language="JavaScript">
<!--
var days = new Array(
'Sunday','Monday','Tuesday',
'Wednesday','Thursday','Friday','Saturday');
var months = new Array(
'January','February','March','April','May',
'June','July','August','September','October',
'November','December');
var now = new Date();
now.setDate(now.getDate()+2);
// now.setDate(33); // for debugging, to see how it handles rollover dates
today = days[now.getDay()] + ", " +
months[now.getMonth()] + " " +
now.getDate();
//-->
</script>
<script type="text/javascript">document.write(today);</script>