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!

Date help

Status
Not open for further replies.

qster

ISP
Mar 11, 2002
55
CA
Hi,

Does any have or know the code to pull information (dates) from a textbox into another textbox for formatting.

What I want to do is take startDate and add 30 Days to that date once I hit a button to calculate the 30 days beyond a date.

Thank you.
 
You can do something like this:
Code:
// AS2
var date1:Date = new Date(2006, 9, 24);
trace("date1: "+date1);
var date2:Date = date1;
date2.setDate(date2.getDate()+30);
trace("date2: "+date2);

Output:
date1: Tue Oct 24 00:00:00 GMT+0100 2006
date2: Thu Nov 23 00:00:00 GMT+0000 2006

I set "date1" as today, then added 30 days to "date1" to create "date2". Please note the European Summer Time (Daylight Saving Time) is about to finish this weekend here in the UK, "date2" correctly shows GMT+0000 - back to "normal", winter time (sad...)

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top