Android Date Add addDay(Date date, int days)

Here you can find the source of addDay(Date date, int days)

Description

add Day

Declaration

public static Date addDay(Date date, int days) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static Date addDay(Calendar c, int days) {
        if (c == null)
            return null;
        c.add(Calendar.DAY_OF_MONTH, days);
        return c.getTime();
    }/*from  www  .  j ava 2s . c o m*/

    public static Date addDay(Date date, int days) {
        Calendar c = getCalendar(date);
        if (c == null)
            return null;
        c.add(Calendar.DAY_OF_MONTH, days);
        return c.getTime();
    }

    public static Calendar getCalendar(Date date) {
        if (date == null)
            return null;
        Calendar c = new GregorianCalendar();
        c.setTime(date);
        return c;
    }
}

Related

  1. add(Date date, int calendarField, int amount)
  2. add(Date date, int calendarField, int amount)
  3. add(Date date, int calendarField, int amount)
  4. addDays(Date date, int amount)
  5. addDays(Date date, int amount)
  6. addDaysToDate(Date date, int daysToBeAdded)
  7. addHours(Date date, int amount)