Add day to date via Calendar - Android java.util

Android examples for java.util:Day

Description

Add day to date via Calendar

Demo Code

import android.annotation.SuppressLint;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class Main{

    public static Date dateAddDay(Date date, int addDay) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);/*from  ww  w . j  a v a 2 s .  co  m*/
        c.add(Calendar.DAY_OF_YEAR, addDay);
        return c.getTime();
    }

}

Related Tutorials