I need to add X no of days to today. So far I have researched most of the questions in stackoverflow and I have tried the following code:
GregorianCalendar today = new GregorianCalendar();
today.setTime(Calendar.getInstance().getTime());
today.add(Calendar.DAY_OF_YEAR,100);//I have also tried Calendar.DATE too
SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-DD");
String currentDate = formatter.format(today.getTime());
System.out.println(currentDate);
When I see the Current Date, I see the month is displayed correctly, but the Date is incorrect. In the above example, I am seeing 2014-04-103 as the output.
I also want the correct date. Please help.
Thanks.