I want to add the number of months based on the duration selected by the user.
I have written the following code, it is taking the current date and adding months based on duration selected by user but I want it to take the start date passed from front end and add the months based on duration.
String le=ra.getLease_period(); //duration
String ls=ra.getLeasestart(); // start date
if (le.equals("1"))
{         
    final SimpleDateFormat df = new SimpleDateFormat( "yyyy-MM-dd" );
    final Date dur1 = df.parse( ls ); // conversion from String
    System.out.println("Start date passed is:" + dur1);
    String m = df.format(dur1);
    System.out.println("Formatted dur1 is" + m);
    final java.util.Calendar cal1 = GregorianCalendar.getInstance();
    cal1.setTime( date );
    cal1.add(GregorianCalendar.MONTH, 1 ); // date manipulation
    System.out.println( "result: " + df.format( cal1.getTime() ) ); 
    ra.setLeaseend(df.format( cal1.getTime() ));       
}
 
     
    