View Full Version : Add Days to a date

07-10-2007, 10:33 PM
I have a datepicker enter a date into a text box in e.g. dd/mm/yyyy. Next I have a drop down box that adds nights (addNights.value) 1,2,3, etc. Lastly I have dateOut text box that is to receive the updated date when nights are added to the first date text box. I have gone through many complicated scenarios but they dont work. For example some things work in IE but not in FF etc. Dates are reversed etc and the code is too complicated. Consequently I want to scrub my code go for a fresh approach. In simple terms it's dateIn.value + nightsNo.value = dateOut.value all in dd/mm/yyyy format that is compatible with both IE and FF. Your help would be more than greatly appreciated.

Test page in question is http://www.kohchangbookingandinformation.com/resorts_2.asp

if(thisform.dateIn.value!=' ') {
thisform.dateOut.value = addDays(document.getElementById('dateIn').value,parseInt(thisform.nightsNo.value));