Java Day Between getDateWithDiff(Date date, int amount)

Here you can find the source of getDateWithDiff(Date date, int amount)

Description

get Date With Diff

License

Open Source License

Declaration

public static Date getDateWithDiff(Date date, int amount) 

Method Source Code

//package com.java2s;

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

public class Main {
    /**//from   w ww  . j a  va2 s.  c  o m
     * 
     * @return
     */
    public static Date getDateWithDiff(Date date, int amount) {
        return getDateWithDiff(date, amount, Calendar.DATE);
    }

    /**
     * 
     * @return
     */
    public static Date getDateWithDiff(Date date, int amount, int field) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(field, amount);
        return calendar.getTime();
    }
}

Related

  1. getDateDiff(Date date, int day)
  2. getDateDiff(final Date startDate, final Date endDate)
  3. getDateDifference(Date date1, Date date2)
  4. getDateDifferenceinDays(Date date1, Date date2)
  5. getDateDiffYear(Date date, int diff, String... format)
  6. getDaysBetween(Date date1, Date date2)
  7. getDaysBetween(Date start, Date end)
  8. getDaysBetween(Date start, Date end)
  9. getDaysBetween(Date startDate, Date endDate)