title: How to Calculating date in Java
body: <p>I am a beginner of java. I need to calculate the date. If I the enter the duration and I select the starting date, the end date should automatically be calculated. I have done this in jQuery and it works.</p>
  
  <p><a href="https://i.stack.imgur.com/rYy8y." rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>this is the working code I tried in jQuery:</p>
  
  <pre><code> $( "#start_date" ).change(function() {
  
          if($( "#duration" ).val()==""){
              return false;
          }
          var x = Number($( "#duration" ).val());
  
  
          var CurrentDate = new Date($("#start_date" ).val());
          CurrentDate.setMonth(CurrentDate.getMonth() + x);
          $("#end_date" ).val(CurrentDate.toISOString().split('T')[0]);
  
      });
  </code></pre>
  
  <p>To select the date I used jDateChooser:</p>
  
  <pre class="lang-java prettyprint-override"><code>int duration = Integer.parseInt(txtdur.getText()); 
  
  Date date = new Date();
  SimpleDateFormat Date_Format = new SimpleDateFormat("yyyy-MM-dd");
  String date1 = Date_Format.format(txtdate.getDate());
  </code></pre>
  
  <p>after that I don't know how complete code</p>