title: validate a dropdown list to get proper date based on the option selected
body: <p><strong>-</strong> I have a <strong>dropdown</strong> List on which there are some options from which user can select one.</p>
  
  <p><strong>- Options are 1 day, 1 week, 2 weeks, 1 month and 6 months</strong></p>
  
  <p><strong>-</strong> Now when I <strong>select option 1 day</strong>, <strong>today's date should be incremented by one</strong> and next date is shown.</p>
  
  <p><strong>-</strong> If I <strong>select 1 week, the date falling after one week should be shown</strong>.</p>
  
  <p><strong>-</strong> Now the problem is when I select an option it <strong>sometimes shows date greater than 30/31</strong>.</p>
  
  <p><strong>-</strong> I use below <code>javacript</code> function:</p>
  
  <pre><code> function select_duration(ddlcupon) {
  
              var skillsSelect = document.getElementById("ddlcupon");
              var selectedText = skillsSelect.options[skillsSelect.selectedIndex].text;
  
              if (selectedText == "1 Day") {
  
                  var currentTime = new Date();
                  var month = currentTime.getMonth() + 1;
                  var day = currentTime.getDate() + 1;
                  var year = currentTime.getFullYear();
                  var exdate = month + "/" + day + "/" + year;
  
                  document.getElementById('&lt;%=txtEventDate.ClientID%&gt;').value = exdate.toString();
  
  
              }
              if (selectedText == "1 Week") {
  
                  var currentTime = new Date();
                  var month = currentTime.getMonth() + 1;
                  var day = currentTime.getDate() + 7;
                  var year = currentTime.getFullYear();
                  var exdate = month + "/" + day + "/" + year;
  
                  document.getElementById('&lt;%=txtEventDate.ClientID%&gt;').value = exdate.toString();
              }
              if (selectedText == "2 Weeks") {
  
                  var currentTime = new Date();
                  var month = currentTime.getMonth() + 1;
                  var day = currentTime.getDate() + 14;
                  var year = currentTime.getFullYear();
                  var exdate = month + "/" + day + "/" + year;
                  document.getElementById('&lt;%=txtEventDate.ClientID%&gt;').value = exdate.toString();
              }
              if (selectedText == "1 Month") {
  
                  var currentTime = new Date();
                  var month = currentTime.getMonth() + 2;
                  var day = currentTime.getDate();
                  var year = currentTime.getFullYear();
                  var exdate = month + "/" + day + "/" + year;
                  document.getElementById('&lt;%=txtEventDate.ClientID%&gt;').value = exdate.toString();
              }
              if (selectedText == "6 Months") {
  
                  var currentTime = new Date();
                  var month = currentTime.getMonth() + 7;
                  var day = currentTime.getDate();
                  var year = currentTime.getFullYear();
                  var exdate = month + "/" + day + "/" + year;
                  document.getElementById('&lt;%=txtEventDate.ClientID%&gt;').value = exdate.toString();
              }
  </code></pre>
  
  <p><strong>-</strong> Can someone help me in getting a <strong>proper date?</strong> </p>