Click here to Skip to main content
15,919,340 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi people i have a function looks like this
JavaScript
var months = new Array(12);
months[0] = "JANUARY";
months[1] = "FEBRUARY";
months[2] = "MARCH";
months[3] = "APRIL";
months[4] = "MAY";
months[5] = "JUNE";
months[6] = "JULY";
months[7] = "AUGUST";
months[8] = "SEPTEMBER";
months[9] = "OCTOBER";
months[10] = "NOVEMBER";
months[11] = "DECEMBER";

var current_date=new Date();
month_value = current_date.getMonth();



Now i am trying to get this function to get the month of 7 days back

How do i do that?
Posted
Updated 10-Feb-10 7:14am
v2

1 solution

Didn't got why you want to use this method.

Use something like:
JavaScript
var todaysDate = new Date();todaysDate.setDate(todaysDate.getDate()-7);

Using date properties, you can get day/month/year of the new date.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900