Java Day Add addDays(Date date, int day)

Here you can find the source of addDays(Date date, int day)

Description

add Days

License

Open Source License

Declaration

public static Date addDays(Date date, int day) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static Date addDays(Date date, int day) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(getMillis(date) + ((long) day) * 24 * 3600 * 1000);
        return c.getTime();
    }/*from w w w . j  a va2s  .  c om*/

    public static long getMillis(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c.getTimeInMillis();
    }
}

Related

  1. addDays(Date d, double count)
  2. addDays(Date d, int days)
  3. addDays(Date d, int n)
  4. addDays(Date date, int amount)
  5. addDays(Date date, int count)
  6. addDays(Date date, int days)
  7. addDays(Date date, int days)
  8. addDays(Date date, int days)
  9. addDays(Date date, int days)