Java Date Before getSomeDaysBeforeAfter(Date date, int days)

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

Description

get Some Days Before After

License

Open Source License

Declaration

public static Date getSomeDaysBeforeAfter(Date date, int days) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {

    public static Date getSomeDaysBeforeAfter(Date date, int days) {
        GregorianCalendar gc = new GregorianCalendar();
        gc.setTime(date);/*  w w  w .  j av  a 2 s  . co m*/
        gc.add(5, days);
        gc.set(gc.get(Calendar.YEAR), gc.get(Calendar.MONTH), gc.get(Calendar.DATE));
        return gc.getTime();
    }
}

Related

  1. getMonthStartDateBeforeCurrent(int monthNum, Date current)
  2. getOneHourBefore(Date date)
  3. getPassedMonthBetweenDate(Date before, Date after)
  4. getPreviousDate(String before)
  5. getQuarterStartDateBeforeCurrent(int num, Date current)
  6. isAtLeastOneDayBefore(Date daybefore, Date dayafter)
  7. isBefore(Date date)
  8. isBefore(Date date1, Date date2)
  9. isBefore2015(Date date)