根据开始日期和持续时间计算结束日期

I have Jquery date picker to select start date and dropdown to select number of weeks.

I'm using below codes to get the end date result but its not working:

    week_number_id.on('change', function(e) {
    var selectvalue = $(this).val();
    //Display 'loading' status in the target select list
    date_result_id.html('<i class="uk-icon-spinner uk-icon-spin"></i>');
    if (selectvalue == '') 
    {
        date_result_id.html(initial_date_result_html);
    } 
    else 
    {
        //Make AJAX request, using the selected value as the GET
        $.ajax({
            url: 'index.php',
            data:'option=com_mycom&task=getmydateHTML&dvalue='+selectvalue,
            success: function(output) {
                date_result_id.html(output);
                updateSelect(date_result_id.val());
            },
            error: function (xhr, ajaxOptions, thrownError) {
                alert(xhr.status +  ' ' + thrownError);
            }
        });
    }
});

and on php code:

 public function getmydateHTML() {
     $jinput = JFactory::getApplication()->input;
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);         
     $dt = $jinput->get ('dvalue');
     $choosendate = $jinput->get ('start_date');       
     $newdate = strtotime("+". $dt . "week", $choosendate);
     echo   date('M d, Y', $newdate);     
    exit; // this will stop Joomla processing, and not output template modules etc.
}     

Result calculating date starting from jan 01, 1970, weeks are increasing correctly but the code can not get the start date

You need to convert the $choosendate to timestamp. You need to create date from your date with valid format.

See the example: https://3v4l.org/SYltO

$week = "+1 weeks"; //"+". $dt . "week"
$str = 'jan 02, 2016';//$jinput->get('start_date')
$date = date_create($str);
$choosendate = date_format($date, "m/d/Y");    
$newdate = strtotime($week, strtotime($choosendate));
echo   date('M d, Y', $newdate);