javadate

How to manipulate Date object


How can I increase by day a date object? being careful of the month.


Solution

  • That's a job for the Calendar class.

    Basically

    Calendar cal = Calendar.getInstance();
    cal.setTime(myDate);
    cal.add(Calendar.DATE, 1);
    myDaye = cal.getTime();
    

    If you're serious about Date/Time manipulation, check out Joda-Time