Thanks for your reply. This comes from the manual, I have tried to change to my variables. I am not getting any error messages, but I am not able to add the $loan_length to the $pay_date. Thanks again for any help. gary <?php $pay_date=($_SESSION['pay_date']); $loan_length=($_SESSION['loan_length']); $orgDate=($_SESSION['pay_date']); $mth=($_SESSION['loan_length']); function add_date($orgDate,$mth){ $cd = strtotime($orgDate); $end_date = date('Y-m-d', mktime(0,0,0,date('m',$cd)+$mth,date('d',$cd),date('Y',$cd))); return $end_date; } echo $orgDate ."<br />"; echo $end_date ."<br />"; echo $pay_date ."<br />"; echo $loan_length; ?> "Nilesh Govindarajan" <lists@xxxxxxxxxx> wrote in message news:4BAE4578.9080006@xxxxxxxxxxxxx > On 03/27/2010 11:13 PM, Gary wrote: >> I have a manual input field to add a date on a form. There is another >> manual input field to add number of months (This is for a loan >> agreement).I am trying to add the two together to get an ending date. I >> dont think I am close, can anyone poimt me in the right direction. >> >> >> $pay_date=($_SESSION['pay_date']); >> $loan_length=($_SESSION['loan_length']); >> >> >> $pay_date = new DateTime($_SESSION['pay_date']); >> >> $end_date = new DateTime($_SESSION['pay_date']) + >> ($_SESSION['loan_length']); >> >> echo $end_date->format("m-d.Y").'<br />'; >> >> >> date_add($pay_date + new DateInterval($_SESSION['loan_length'])); >> echo '<br />'.$date->format("d-m-Y"); >> >> Gary >> >> __________ Information from ESET NOD32 Antivirus, version of virus >> signature database 4978 (20100326) __________ >> >> The message was checked by ESET NOD32 Antivirus. >> >> http://www.eset.com >> >> >> >> > > Add time in Unix Timestamps. Then format it using strftime. > > Also to format inputted date time in the form, check in php manual, to > convert dates to timestamps (i forgot the func. name). > > -- > Nilesh Govindarajan > Site & Server Administrator > www.itech7.com > ???? ???? ???? ! > ?? ????: ?????? ???? ! > > __________ Information from ESET Smart Security, version of virus > signature database 4978 (20100326) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > > __________ Information from ESET Smart Security, version of virus signature database 4978 (20100326) __________ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php