Click to See Complete Forum and Search --> : date help
Pacificer
04-27-2005, 08:15 AM
Hi there wondering if anyone can help me with a function :)
i need to write a script whereby when a program reach a certain date for example 10 april, it will return to me the first and last date of the previous month which is march.....and it continue as follow with every month....
thanks..
can u show us what have u done so far (as we don't use to solve homeworks)?
Pacificer
04-27-2005, 09:40 AM
var months=new Array(13);
months[1]="January";months[2]="February";months[3]="March";months[4]="April";months[5]="May";months[6]="June";months[7]="July";months[8]="August";months[9]="September";months[10]="October";months[11]="November";months[12]="December";
var time=new Date();var lmonth=months[time.getMonth() + 1] var date=time.getDate();var year=time.getYear();if (year < 2000)
year = year + 1900;
jus manage to come out with the current date...need to noe hw to loop through the months...when a date is selected..it will return the first n last date of the previous month...
very few... have you ever considered the new Date(yyyy,m,d) method of setting a certain date?