View Full Version : adding to dates from input box

07-21-2009, 05:58 AM

I searched and searched but could not find a idea that can light me. if anyone point me to article or tutorial on this would be appreciated.

i have found one, and its close to it and need a little tweak to work on second textbox

<script language="JavaScript">
function addDays(myDate, days){
return myDate;

document.write(addDays(new Date("7/16/2004"),30));

i have two input textbox for dates, one is date borrowed
which from date picker calendar 07/21/2009
and what i would like to make is the second textbox would be auto compute for X months
meaning the second input textbox whould display a value = 01/21/2010 if i assign a 6 months variable

Philip M
07-21-2009, 10:30 AM
function addMonths(myDate,months) {
myDate.setMonth(myDate.getMonth() + months);
return myDate;

document.write(addMonths(new Date("7/21/2009"),6)); // 21 January 2010It is your responsibility to die() if necessary….. - PHP Manual