Okay. its not a struts questions and probably should be sent to a JavaScript forum. but i spirit of Struts; here is what i would call a very crude method of doing it. i hope it would give you a starting point.
<javascript> function doIt() { var today = new Date(); var fridays = new Array(); for (i = 1; i <= 365; i++) { d = new Date(today - (86400000 * i)); if (d.getDay() == 5) { fridays.splice(fridays.length, 0, d); } } for (i = 0; i < fridays.length; i++) { // show it in a text field on this page! document.forms[0].t1.value = document.forms[0].t1.value + fridays[i].toString(); } } </javascript> the Date object in javascript, when constructed without any arguments is initialized with today's date. that's exactly what 'today' variable is for. now, Date object could also be initialized with milliseconds and it also support addition and substraction. there are 86400000 ms in a day. and we go back 365 days from today! the getDay() method on Date object returns 0 for Sunday, 1 for Monday and so on. so we get only Fridays when getDay() == 5! crude as i said. i'd get the first friday and increment 'i' by 7 instead of 1. Oh, and by the way, Array.splice() makes javascript Array object as dynamic and ArrayList in java! hope this would help. ATTA ----- Original Message ----- From: "Joseph William" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 02, 2003 11:48 AM Subject: URGENT... HELP NEEDED... > Hi All... > > This has got nothing to do with Struts... It is javascript function I am developing... > > I need to generate all Friday dates for the past one year from the current date... Has anyone got such code??? I tried to search the net but wasn't able to find anything very precise... It would be of great help if anyone can help me here... > > Appreciate your guidance... Thanks! > > -Joseph > > > --------------------------------- > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]