Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subtracting days from a date

Status
Not open for further replies.

vaks009

Programmer
Jun 14, 2001
11
CA
Hi Gurus:
I am new to Javascripting. Please help me with this issue.
i want to subtract 7 days from a given date in format
"2002-10-25 12:39:55".
7 days is defined as 7 whole days. For example ("2002-10-25 12:39:55" - 7 ) should be "2002-10-18 12:00:00"
thanks in advance.
vaks
 
will need to get the days from the date and restructure the date after making the calculations
for example
myDate = new Date();
myDays = myDate.getDays()-7
alert(myDays)

here are a few links to help you
---------------------------------------
{ str = "sleep is good for you. sleep gives you the energy you need to function";
ptr = /sleep/gi;Nstr = str.replace(ptr,"coffee");alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top