title: how to add no of weeks to jquery ui datepicker?
body: <p>This is my jsp page and in that i am using date picker but instead of range from two date picker i just want to use week .if i have select start date and then i have to write no of weeks and then how can i calculate the end date on basis of that no of weeks and start date?
  i m new in this jquery so any one can help me out?   </p>
  
  <pre><code>&lt;%@page import="com.liferay.portal.model.Role"%&gt;
      &lt;%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
      &lt;%@page import="com.liferay.portal.util.PortalUtil"%&gt;
      &lt;%@page import="com.liferay.portal.model.Organization"%&gt;
      &lt;%@ include file="/init.jsp"%&gt;
      &lt;script src="&lt;%=request.getContextPath()%&gt;/js/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;&lt;/script&gt; 
      &lt;link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/themes/south-street/ui.all.css" type="text/css"&gt; 
      &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"&gt;&lt;/script&gt; 
  
      &lt;script type="text/javascript" src="&lt;%=request.getContextPath() %&gt;/js/jquery.validate.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="&lt;%=request.getContextPath() %&gt;/js/jquery.ui.datepicker.validation.js"&gt;&lt;/script&gt;
  
      &lt;script src="&lt;%=request.getContextPath()%&gt;/js/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="&lt;%=request.getContextPath()%&gt;/js/jquery.validate.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="&lt;%=request.getContextPath()%&gt;/js/jquery.ui.datepicker.validation.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="&lt;%=request.getContextPath()%&gt;/lib/datepicker/bootstrap-datepicker.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="&lt;%=request.getContextPath()%&gt;/lib/chosen/chosen.jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
       $(function(){
           $('#validBeforeDatepicker, #validAfterDatepicker').datepicker();           
           $('#validateForm').validate({
               rules:{
                   startDate:{
                       required: true,
                       dpDate: true
                   }
               }
           });
       });
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
      function newcamp(addToDo){   
         var camp_name =document.getElementById('camp_name').value; 
          var camp_description =document.getElementById('camp_description').value;   
          var weeks =document.getElementById('weeks').value;  
         ////make new array to push all the selected value of restId from multi select box 
                          var rest_list = new Array();
                              var mySelectrest = document.getElementById('rest_id');
                              while (mySelectrest.selectedIndex != -1) {                      
                                  rest_list.push(mySelectrest.options[mySelectrest.selectedIndex].value);                     
                                  mySelectrest.options[mySelectrest.selectedIndex].selected = false;
                              }
                              var str = "";
                              for ( var i = 0; i &lt; rest_list.length; i++) {
                                  str = str + rest_list[i];
                                  if (i &lt; rest_list.length - 1)
                                      str = str + "-";
                                  }
       ////make new array to push all the selected value of Standbyadlist from multi select box   
                          var standbyad_list = new Array();
                              var mySelectstandbyad = document.getElementById('selectstandbyad');
                              while (mySelectstandbyad.selectedIndex != -1) {                         
                                  standbyad_list.push(mySelectstandbyad.options[mySelectstandbyad.selectedIndex].value);                          
                                  mySelectstandbyad.options[mySelectstandbyad.selectedIndex].selected = false;
                              }
                              var standbyad_str = "";
                              for ( var i = 0; i &lt; standbyad_list.length; i++) {
                                  standbyad_str = standbyad_str + standbyad_list[i];
                                  if (i &lt; standbyad_list.length - 1)
                                      standbyad_str = standbyad_str + "-";
                                  }                       
      ////make new array to push all the selected value of slideradlist from multi select box
  
                          var sliderad_list = new Array();
                              var mySelectsliderad = document.getElementById('selectsliderad');
  
                              while (mySelectsliderad.selectedIndex != -1) {
  
                                  sliderad_list.push(mySelectsliderad.options[mySelectsliderad.selectedIndex].value);
  
                                  mySelectsliderad.options[mySelectsliderad.selectedIndex].selected = false;
                              }
  
                              var sliderad_str = "";
                              for ( var i = 0; i &lt; sliderad_list.length; i++) {
                                  sliderad_str = sliderad_str + sliderad_list[i];
                                  if (i &lt; sliderad_list.length - 1)
                                      sliderad_str = sliderad_str + "-";
                                  }
  
      ////make new array to push all the selected value of eventbaseadlist from multi select box
  
                          var eventbasead_list = new Array();
                              var mySelecteventbasead = document.getElementById('selecteventbasead');
  
                              while (mySelecteventbasead.selectedIndex != -1) {
  
                                  eventbasead_list.push(mySelecteventbasead.options[mySelecteventbasead.selectedIndex].value);
  
                                  mySelecteventbasead.options[mySelecteventbasead.selectedIndex].selected = false;
                              }
  
                              var eventbasead_str = "";
                              for ( var i = 0; i &lt; eventbasead_list.length; i++) {
                                  eventbasead_str = eventbasead_str + eventbasead_list[i];
                                  if (i &lt; eventbasead_list.length - 1)
                                      eventbasead_str = eventbasead_str + "-";
                                  }
  
      ////make new array to push all the selected value of homescreenadlist from multi select box
  
                          var homescreenad_list = new Array();
                              var mySelecthomescreenad = document.getElementById('selecthomescreenad');
  
                              while (mySelecthomescreenad.selectedIndex != -1) {
  
                                  homescreenad_list.push(mySelecthomescreenad.options[mySelecthomescreenad.selectedIndex].value);
  
                                  mySelecthomescreenad.options[mySelecthomescreenad.selectedIndex].selected = false;
                              }
  
                              var homescreenad_str = "";
                              for ( var i = 0; i &lt; homescreenad_list.length; i++) {
                                  homescreenad_str = homescreenad_str + homescreenad_list[i];
                                  if (i &lt; homescreenad_list.length - 1)
                                      homescreenad_str = homescreenad_str + "-";
                                  }               
                              $.ajax({
                                  url : addToDo,
                                  data : {
                                      "camp_name" : camp_name,
                                      "camp_description" : camp_description,
                                      "weeks" : weeks,
                                      "rest_list" : str,
                                      "standbyad_adlist":standbyad_str ,
                                      "sliderad_adlist":sliderad_str ,
                                      "eventbasead_adlist": eventbasead_str,
                                      "homescreenad_adlist": homescreenad_str,
                                      "CMD" : "addToDo"
                                  },
                                  type : "POST",
                                  timeout : 20000,
                                  dataType : "text",
                                  success : function(data) {
                                      showMsg(data,'Campaign',1);
                                  }
                              });
                          }
                      &lt;/script&gt;
      &lt;%  
      String Role_name=null;
      boolean flag=false; ///advertiser if flag is false else Reseller
      long org_id_camp=0;
      List&lt;Role&gt; role_list=themeDisplay.getUser().getRoles(); 
      for(Role role_name:role_list){  
          if(role_name.getName().equals("Reseller")){
              flag=true;
              Role_name=role_name.getName();      
              break;                                  
          }           
      }if(!flag){ 
          Role_name="Advertiser";
      }
  
      //Get Common Advertise List
      List&lt;advertise&gt; adv_list;
      if(flag)
      {
          adv_list = advertiseLocalServiceUtil.getAllAdvertiseByOrganizations(themeDisplay);
          System.out.print("Reseller ad count " + adv_list.size());
      }
      else
      {
          adv_list = advertiseLocalServiceUtil.getAllAdvertiseByOrganizationId(themeDisplay);
          System.out.print("Advertiser ad count " + adv_list.size());
      }
      //Get Banner Advertise List
      List&lt;advertise&gt; banner_adv_list;
      if(flag)
      {
          banner_adv_list = advertiseLocalServiceUtil.GetBannerAdvByOrganizations(themeDisplay);
          System.out.print("Reseller banner_adv_list count " + adv_list.size() + "--------");
      }
      else
      {
          banner_adv_list = advertiseLocalServiceUtil.GetBannerAdvByOrganization(themeDisplay);
          System.out.print("Advertiser banner_adv_list count " + adv_list.size() + "--------");
      }                           
      %&gt;      
          &lt;nav&gt;
          &lt;div id="jCrumbs" class="breadCrumb module"&gt;
              &lt;ul&gt;
                  &lt;li&gt;&lt;a href="#"&gt;&lt;i class="icon-home"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#"&gt;&lt;%=Role_name %&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;Create Campaign&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
          &lt;/nav&gt;
          &lt;div class="span10"&gt;
              &lt;h3 class="heading"&gt;Create Campaign&lt;/h3&gt;
              &lt;portlet:actionURL var="adCampaignURL" name="addCampaign"&gt;&lt;/portlet:actionURL&gt;
              &lt;portlet:resourceURL var="addToDo" id="addToDo_camp"&gt;&lt;/portlet:resourceURL&gt;     
              &lt;div id="toDoList"&gt;
                  &lt;div class="row-fluid"&gt;
                      &lt;div class="span12"&gt;
                          &lt;label&gt;Campaign Name &lt;span class="f_req"&gt;*&lt;/span&gt;&lt;/label&gt; &lt;input
                              type="text" name="camp_name" id="camp_name" class="span8" /&gt; &lt;span
                              id="restError" style="color: #C62626;" class="help-block"&gt;&lt;/span&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="row-fluid"&gt;
                      &lt;div class="span12"&gt;
                          &lt;label&gt;Campaign Description &lt;/label&gt;
                          &lt;textarea name="camp_description" id="camp_description" cols="10"
                              rows="3" class="span8"&gt;&lt;/textarea&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="row-fluid"&gt;
                      &lt;div class="span3"&gt;
                          &lt;!--   &lt;label&gt;Start Date &lt;span class="f_req"&gt;*&lt;/span&gt;&lt;/label&gt;
                                          &lt;input type="text" name="start_date" id="start_date" class="span8" id="dp1" /&gt;
                                           &lt;span id="restError1" style="color: #C62626;" class="help-block"&gt;&lt;/span&gt;       --&gt;
  
                          Select Date: From &lt;input type="text" id="validBeforeDatepicker"
                              name="validTodayDatepicker" &gt; To &lt;input type="text"
                              id="validAfterDatepicker" name="validAfterDatePicker"&gt;
                      &lt;/div&gt;
                      &lt;div class="span3"&gt;
                          &lt;label&gt;Weeks&lt;span class="f_req"&gt;*&lt;/span&gt;&lt;/label&gt; &lt;input type="text"
                              name="weeks" id="weeks" class="span8" id="dp1" onchange="advurldisabled();"/&gt; &lt;span
                              class="help-block"&gt;(List of week in incremental order)&lt;/span&gt; &lt;span
                              id="restError2" style="color: #C62626;" class="help-block"&gt;&lt;/span&gt;
  
                      &lt;/div&gt;
                      &lt;div class="span3"&gt;
                          &lt;label&gt;Restaurants &lt;span class="f_req"&gt;*&lt;/span&gt;&lt;/label&gt; 
                          &lt;select id="rest_id" name="rest_id" data-placeholder="- Select Restaurants -" class="chzn-select" multiple&gt;                     
                              &lt;%                      
                              List &lt;restaurant&gt; rest_list=restaurantLocalServiceUtil.getAllRestaurantByOrganizationId(themeDisplay);                                                          
                              for(int i=0;i&lt;rest_list.size();i++) {
                              %&gt;
                                  &lt;option value=&lt;%=rest_list.get(i).getPrimaryKey()%&gt;&gt;&lt;%=rest_list.get(i).getName().toString()%&gt;&lt;/option&gt;
                              &lt;%
                              }
                              %&gt;
                          &lt;/select&gt; 
                          &lt;span id="restError3" style="color: #C62626;" class="help-block"&gt;&lt;/span&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;br /&gt;
                  &lt;br /&gt;
  
  
  
                  &lt;h3 class="heading"&gt;Select Ad Location&lt;/h3&gt;
                  &lt;div class="row-fluid"&gt;
                      &lt;div class="span12"&gt;
                          &lt;table style="width: 675px;"&gt;
                              &lt;tr&gt;
                                  &lt;td style="font-weight: bold; width: 150px;"&gt;Stand By Ad 
                                  &lt;a href="#" class="pop_over" data-content="&lt;table&gt;&lt;tr&gt;&lt;td valign='top'&gt;Lorem Ipsum Lorem Ipsum Lorem &lt;/br&gt; Lorem Ipsum Lorem Ipsum Lorem &lt;/td&gt;&lt;td&gt;&lt;img src='img/vimeo.png' height='50' width='50'/&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"
                                      data-original-title="( Ad name )" data-placement="left"&gt;
                                      &lt;sup style="font-size: 10px;"&gt; ?&lt;/sup&gt;&lt;/a&gt;
                                  &lt;/td&gt;
                                  &lt;td&gt;
                                      &lt;select data-placeholder="Select Ad" class="chzn-select" multiple name="selectstandbyad" id="selectstandbyad"&gt;
                                          &lt;% for (int i = 0; i &lt; adv_list.size(); i++) { %&gt;
                                              &lt;option value=&lt;%=adv_list.get(i).getPrimaryKey()%&gt;&gt;&lt;%=adv_list.get(i).getAdvertisename().toString()%&gt;&lt;/option&gt;
                                          &lt;% } %&gt;
                                      &lt;/select&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/table&gt;
                          &lt;div class="formSep"&gt;&lt;/div&gt;
                          &lt;table style="width: 675px;"&gt;
                              &lt;tr&gt;
                                  &lt;td style="font-weight: bold; width: 150px;"&gt;Slider Ad&lt;/td&gt;
                                  &lt;td&gt;&lt;select data-placeholder="Select Ad" class="chzn-select"
                                      multiple name="selectsliderad" id="selectsliderad"&gt;
  
                                          &lt;%
                                              for (int i = 0; i &lt; adv_list.size(); i++) {
                                          %&gt;
                                          &lt;option value=&lt;%=adv_list.get(i).getPrimaryKey()%&gt;&gt;&lt;%=adv_list.get(i).getAdvertisename().toString()%&gt;&lt;/option&gt;
                                          &lt;%
                                              }
                                          %&gt;
                                  &lt;/select&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/table&gt;
                          &lt;div class="formSep"&gt;&lt;/div&gt;
                          &lt;table style="width: 675px;"&gt;
                              &lt;tr&gt;
                                  &lt;td style="font-weight: bold; width: 150px;"&gt;Event Based Ad&lt;/td&gt;
                                  &lt;td&gt;&lt;select data-placeholder="Select Ad" class="chzn-select"
                                      multiple name="selecteventbasead" id="selecteventbasead"&gt;
                                          &lt;%
                                              for (int i = 0; i &lt; adv_list.size(); i++) {
                                          %&gt;
                                          &lt;option value=&lt;%=adv_list.get(i).getPrimaryKey()%&gt;&gt;&lt;%=adv_list.get(i).getAdvertisename().toString()%&gt;&lt;/option&gt;
                                          &lt;%
                                              }
                                          %&gt;
                                  &lt;/select&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/table&gt;
                          &lt;div class="formSep"&gt;&lt;/div&gt;
                          &lt;table style="width: 675px;"&gt;
                              &lt;tr&gt;
                                  &lt;td style="font-weight: bold; width: 150px;"&gt;Banner Ad&lt;/td&gt;
                                  &lt;td&gt;&lt;select data-placeholder="Select Ad" class="chzn-select"
                                      multiple name="selecthomescreenad" id="selecthomescreenad"&gt;
  
                                          &lt;%
                                              for (int i = 0; i &lt; banner_adv_list.size(); i++) {
                                          %&gt;
                                          &lt;option value=&lt;%=banner_adv_list.get(i).getPrimaryKey()%&gt;&gt;&lt;%=banner_adv_list.get(i).getAdvertisename().toString()%&gt;&lt;/option&gt;
                                          &lt;%
                                              }
                                          %&gt;
                                  &lt;/select&gt;&lt;/td&gt;
                              &lt;/tr&gt;
  
                          &lt;/table&gt;
                          &lt;span id="restError4" style="color: #C62626;" class="help-block"&gt;&lt;/span&gt;
                          &lt;div class="formSep"&gt;&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-actions"&gt;
                      &lt;button class="btn" onclick="campaignList();"&gt;Cancel&lt;/button&gt;
                      &lt;button type="button" style="float: right;" class="btn"
                          name="btnback" onclick="customeValidationfornewcamp();"&gt;Save&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;!-- hide elements (for later use) --&gt;
              &lt;div class="hide"&gt;
                  &lt;!-- actions for datatables --&gt;
                  &lt;div class="dt_gal_actions"&gt;
                      &lt;div class="btn-group"&gt;
                          &lt;button data-toggle="dropdown" class="btn dropdown-toggle"&gt;
                              Action &lt;span class="caret"&gt;&lt;/span&gt;
                          &lt;/button&gt;
                          &lt;ul class="dropdown-menu"&gt;
                              &lt;li&gt;&lt;a href="#" class="delete_rows_dt" data-tableid="dt_gal"&gt;&lt;i
                                      class="icon-trash"&gt;&lt;/i&gt; Delete&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="javascript:void(0)"&gt;Lorem ipsum&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href="javascript:void(0)"&gt;Lorem ipsum&lt;/a&gt;&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;!-- confirmation box --&gt;
                  &lt;div id="confirm_dialog" class="cbox_content"&gt;
                      &lt;div class="sepH_c tac"&gt;
                          &lt;strong&gt;Are you sure you want to delete this row(s)?&lt;/strong&gt;
                      &lt;/div&gt;
                      &lt;div class="tac"&gt;
                          &lt;a href="#" class="btn btn-gebo confirm_yes"&gt;Yes&lt;/a&gt; &lt;a href="#"
                              class="btn confirm_no"&gt;No&lt;/a&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;script type="text/javascript"&gt;
                          function redirection(myurl){
                              window.location=myurl;
                          }
                      &lt;/script&gt;
              &lt;script type="text/javascript"&gt;
                      function customeValidationfornewcamp() {
                          var flag = true;
                          var camp_name = $("#camp_name").val();
  
                          var startdate = $("#start_date").val();
  
                          var week = $("#weeks").val();
  
                          var rest_id=$("#rest_id").val();
  
                          var standby_ad=$("#selectstandbyad").val();
                          var slider_ad=$("#selectsliderad").val();
                          var event_ad=$("#selecteventbasead").val();
                          var homescreen_ad=$("#selecthomescreenad").val();
  
  
                          if (camp_name == '') {
  
                              $("#restError").html('Campaign name cannot be blank');
                              $("#camp_name").addClass('borderColor');
                              flag = false;
                          } else {
                              $("#restError").html('');
                              $("#camp_name").removeClass('borderColor');
                          }
  
                          if (startdate == '') {
                              $("#restError1").html('Start date cannot be blank');
                              $("#start_date").addClass('borderColor');
                              flag = false;
                          } else {
                              $("#restError1").html('');
                              $("#start_date").removeClass('borderColor');
                          }
  
  
  
                          if (week == '') {
  
                              $("#restError2").html('Week can not be blank');
                              $("#weeks").addClass('borderColor');
                              flag = false;
                          } else {
                              $("#restError2").html('');
                              $("#weeks").removeClass('borderColor');
                          }
  
                          if (rest_id == null) {
  
  
  
                              $("#restError3").html('Please Select atleast one restaurant');
                              $("#rest_id").addClass('borderColor');
                              flag = false;
                          } else {
  
                              $("#restError3").html('');
                              $("#rest_id").removeClass('borderColor');
                          }
  
                          if ((standby_ad==null)&amp;&amp;(slider_ad==null)&amp;&amp;(event_ad==null)&amp;&amp;(homescreen_ad==null)) {
  
                              $("#restError4").html('Please select atleast one Ad Location');
                              $('#selectstandbyad').addClass('borderColor');
                              flag = false;
                          } else {
                              $("#restError4").html('');
                              $("#selectstandbyad").removeClass('borderColor');
                          }                
  
                          if (flag == true) {
                              newcamp('&lt;%=addToDo%&gt;');
                      }
                      return flag;
                  }
              &lt;/script&gt;
          &lt;script type="text/javascript"&gt;
              // function to add number of days (accepts number of days to add)
  
              function advurldisabled() {
  
                  var days= $("#weeks").val();
                  var thisDate = $("#validBeforeDatepicker").datepicker("getDate");
  
                  //thisDate.setDate(thisDate.getDate() + days);
  
                  alert(thisDate);
  
  
              }
  
              // call your function like this
  
  
          &lt;/script&gt;
  
              &lt;script type="text/javascript"&gt;
                  $(".chzn-select").chosen();
                  $(".chzn-select-deselect").chosen({
                      allow_single_deselect : true
                  });     
                  $(document).ready(function() {
                      $('#dp1').datepicker({
                          format : 'dd-mm-yyyy'
                      }).on('changeDate', function() {
                          $(this).datepicker('hide');
                      });
                      //* show all elements &amp; remove preloader                        
                      setTimeout('$("html").removeClass("js")', 1000);
                      $("#addPrv").click(function() {
                          var url = $("#advurl").val();
                          if (url == '') {
                              alert('Please enter Adv url for redirection')
                          } else {
                              window.location = url;
                          }
                      });
                  });
              &lt;/script&gt;
  
          &lt;/div&gt;
  </code></pre>
  
  <p>this is my javascript i m using now...</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          // function to add number of days (accepts number of days to add)
  
          function advurldisabled() {
  
              var days= $("#weeks").val();
              var thisDate = $("#validBeforeDatepicker").datepicker("getDate");
              d = $('#validBeforeDatepicker').datepicker('getDate');
              d.setDate(d.getDate()+days); // add int nights to int date
              alert(d);
              //thisDate.setDate(thisDate.getDate() + days);
  
              alert(thisDate);
  
  
          }
  </code></pre>
  
  <p>but the d variable is coming null</p>
  
  <p>I have made changes in following way in my java script</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          // function to add number of days (accepts number of days to add)
  
          function advurldisabled() {
  
              var days= $("#weeks").val();
              var thisDate = $("#validBeforeDatepicker").datepicker("getDate");
              alert(thisDate);
              thisDate.setDate(thisDate.getDate() + days);
  
              alert(thisDate);
  
              var d = $('#validBeforeDatepicker').datepicker('getDate');
                  d.setDate(d.getDate()+days); // add int nights to int date
                  alert(d);
          }
  
          // call your function like this
  
  
      &lt;/script&gt;
  </code></pre>
  
  <p>first allert is showing following date format</p>
  
  <pre><code>Thu Nov 08 2012 00:00:00 GMT+0530 (India Standard Time)
  </code></pre>
  
  <p>second alert showing following value which is taking no of weeks as input and i had inserted 1 number in weeks field and result is follows</p>
  
  <pre><code>Sun Jan 20 2013 00:00:00 GMT+0530 (India Standard Time)
  </code></pre>
  
  <p>right now i just adding weeks directly..withought doing multiply by 7 but just for testing but still instead of Nov 09 its giving difrent date..please guide me where am doing mistake</p>