add Day to Date value - Android java.util

Android examples for java.util:Day

Description

add Day to Date value

Demo Code

import android.content.Context;
import android.provider.Settings;
import android.telephony.PhoneNumberUtils;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static Date addDay(Date date, int numberDay) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);/*from w w  w . j  a v a  2  s  .c om*/
        calendar.add(Calendar.DATE, numberDay);
        return calendar.getTime();
    }

}

Related Tutorials