I am trying to use a sript to redirect my blog (
http://pomolectionary.blogspot.com) to it's current archive page. (
http://pomolectionary.blogspot.com/2...y_archive.html) To do that I need the script to give me the date of the most recent Sunday in yyyy_MM_dd_ format. I've gotten some code off of the forum here that has gotten me started, but I can't chanage the format. Anyone know how? or do you have an easier code to accomplish the same thing?
Here's what I have so far.
<HTML>
<HEAD>
<script language="Javascript">
function DateAdd(objDate, intDays)
{
var iSecond=1000;
var iMinute=60*iSecond;
var iHour=60*iMinute;
var iDay=24*iHour;
var objReturnDate=new Date();
objReturnDate.setTime(objDate.getTime()+(intDays*i Day));
return objReturnDate;
}
function GetLastSunday()
{
var dtToday=new Date();
if (dtToday.getDay()==0)
return dtToday();
var dtLastSunday=DateAdd(dtToday,-(dtToday.getDay()));
return dtLastSunday;
}
function ShowSun()
{
document.write(GetLastSunday());
}
</script></HEAD>
<BODY>
<script>ShowSun()</script>
</BODY>
Thanks,
Chris C Hooton