Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

functin that will show date for each Wednesday of current week.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello. I need a function that will give me the date for the each Wednesday of the current week.

Any ideas?

Thank you,
Rene
 
<html>
<body>
<script type=&quot;text/javascript&quot;>

function DaysFromNow (nn) {
var dt1 = new Date();
var dt2 = new Date(dt1.valueOf() + (nn * 86400000));
var gmtstr = (Date.toUTCString) ? dt2.toUTCString() : dt2.toGMTString();
return gmtstr.slice(0, -4) + &quot; GMT&quot;;
}

var dt = new Date()
document.write(&quot;Today= &quot; + dt.toGMTString() + &quot;<br>&quot;);
var j = new Array(3,2,1,0,-1,-2,-3);
var i = dt.getDay();
document.write (&quot;This week's wednesday = &quot;);
document.write( DaysFromNow( j[ i ] ));
</script>
</body>
</html>
br
Gerard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top