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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add days to date

Status
Not open for further replies.

garry1

Programmer
Dec 6, 2002
49
0
0
US
I have text box 1 where user can enter date in mm/dd/yy or mm/dd/yyyy format. I would like to populate the text box 2 by adding 10 days to the date entered in the text box 1.
How do I add 10 days to the date in entered in mm/dd/yy or mm/dd/yyyy format.
Thanks.
 
Maybe this will help....
Code:
<script type="text/javascript">
	var d = new Date("04/10/2006");
	d.setDate(d.getDate()+10);
	alert((d.getMonth()+1)+"/"+d.getDate()+"/"+d.getYear());
</script>
... with Javascript it may be a good idea to use the full year.
 
If the date is in the following format "10-Apr-2006" how do I add 10 days to the above date format.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top