0

Sir I have a date like "08-25-2013" as a string, I got the number of days from this string date, now I add few number days in it like long days=days+250; now the question is how can I get the date like "05-02-2014" as a string. Please answer me as soon as possible please thanks in advance respected sir. Qustions: number of days convert to the date.

1 Answers1

0

Use this code

            SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        Date dateparsed = sdf.parse("29-08-2013");
        Calendar c = Calendar.getInstance();
        c.setTime(dateparsed); 
        c.add(Calendar.DATE, 250); // Adding n number of days 
        String output = sdf.format(c.getTime());
        System.out.println(output);
Developer
  • 6,292
  • 19
  • 55
  • 115