-1

Working on Java 7, i have the following String date = "12/04/2012".

I converted the String to a Date format:

Date date_converted = DateUtils.parse(DateUtils.STANDARD, date);

Now i want to add a day to my Date, someone can help me?

Removed
  • 109
  • 3
  • 19

1 Answers1

1
Calendar cal = Calendar.getInstance();
cal.setDate(date_converted);
cal.add(Calendar.Date, numberOfDays);
date_converted = cal.getTime();

The above is the easiest way of doing it in Java 7. You can easily subtract days by passing negative number.

xenteros
  • 15,586
  • 12
  • 56
  • 91