title: How to set current date and end date based on subscription period?
body: <p>I need to pass total months from JSP page to servlet and the servlet will set the starting date and ending date of subscription.</p>
  
  <p>Suppose I passed 1 month from JSP page then servlet should able to add subscription date as current date and expiry date after 1 month into database.</p>
  
  <p>I am using Oracle database and am not able to develop the logic for this. Please help me regarding this.</p>
  
  <pre><code>Date dNow = new Date( );
  SimpleDateFormat ft = new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
  String currentdate=ft.format(dNow);
  String expirydate=ft.format(null);
  
  
  Calendar c = Calendar.getInstance();
  try {
      c.setTime(ft.parse(currentdate));
      c.add(Calendar.DATE, period_1);
      expirydate=ft.format(c.getTime());
  }
  catch (ParseException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }
  </code></pre>