View Full Version : Adding days to a date

07-22-2005, 02:59 PM
Howdy all,

Does anyone know of a script to add days to a date? For example, in textbox1, I have date value (say - 7/1/2005). In textbox2, I want that date plus seven days to be displayed (7/8/2005) (textbox1 will be different depending on when the user opens the form). I can't seem to figure this one out for the life of me...

- Isaac

07-22-2005, 03:29 PM
<title>Up Date - Demo</title>
<script type="text/javascript">
function upDate(dt1, dt2){
var aDate=new Date(document.getElementById(dt1).value)
var aMonth=aDate.getMonth()+1
var aDay=aDate.getDate()
var aYear=aDate.getFullYear()
<input type="text" value="12/27/2005" id="dateOne"><br>
<input type="text" value="" id="dateTwo"><br>
<input type="button" value="UpDate" onclick="upDate('dateOne', 'dateTwo');"><br>