Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 23rd, 2005, 11:47 PM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default date code help needed.

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Source code needed VB Learner Wrox Book Feedback 0 January 13th, 2008 09:51 PM
Help needed - data from Excel sht where Date>= xx pandasum Visual Basic 2005 Basics 0 August 19th, 2007 11:34 PM
HELP Needed in Date Manipulation kunjan SQL Language 9 March 19th, 2006 09:51 PM
Date Comparison Code Needed jackson_jl Beginning VB 6 0 March 14th, 2005 12:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.