catspeake
function adjustDate($maturitydate, $add) { $nodays = '+'.$add.' days'; $date = new DateTime($maturitydate); $matdt = $date->modify($nodays); $ismaturitydateendofmonth = check_end_of_month($maturitydate); if($date->format('d') == 15) { $matdt = $matdt->format('m/15/Y'); } else if($ismaturitydateendofmonth == '1'){ $matdt->modify('last day of this month'); } else{ $matdt = $matdt->format('m/d/Y'); } return $matdt;}function check_end_of_month($date){ //adds 1 day to date $Temp = date('m/d/Y',strtotime("+1 day", strtotime($date))); //get the month of each date $tempmonth = date('m', strtotime($Temp)); $datemonth = date('m', strtotime($date)); //check if the months are equal if($tempmonth != $datemonth){ return '1'; } else{ return '0'; }}