Date - Weekly 2

 

Display target days date until day is reached then show target day display.

At the end of the current target day the next target days date is shown.

Target day is set within the script at variable targetDay=3 where sun=0 mon=1 tues=2 wed=3 thur=4 fri=5 sat=6

This examples target day is wednesday.

<script type="text/javascript">
<!-- 

targetDay=3 // sun=0 mon=1 tues=2 wed=3 thur=4 fri=5 sat=6
next=1 // 0 = show previous target date, 1 = show next target date

function showWeekly(){
today = new Date()
dayNum=today.getDay()
days=0

if(dayNum!=targetDay){
days=Math.abs(targetDay - dayNum)

if(next==0){days=-days}
if(next==1){days=(7-dayNum)+targetDay}

}

today.setDate(today.getDate() + days)

dys=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"]
mths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"]

document.getElementById("display").innerHTML=dys[today.getDay()]+" "+mths[today.getMonth()]+" "+today.getDate()+" "+today.getFullYear()

if(dayNum==targetDay){
document.getElementById("display").innerHTML+="<br>Today Is Target Day"
}

}

// -->
</script>

<span id="display"> </span>