Java Date to Day getDaysEarlierDate(int days)

Here you can find the source of getDaysEarlierDate(int days)

Description

Purpose:
getDaysEarlierDate

License

Open Source License

Parameter

Parameter Description
days a parameter

Return


Declaration

public static Date getDaysEarlierDate(int days) 

Method Source Code

//package com.java2s;

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

public class Main {
    /**/*from  w w  w  . j a v  a  2 s.co m*/
     * Purpose:
     * <br>
     * getDaysEarlierDate<br>
     * <br>
     * @param days
     * @return<br>
     */
    public static Date getDaysEarlierDate(int days) {
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.DAY_OF_YEAR, -(days));
        return cal.getTime();
    }
}

Related

  1. getDayNumber(Date startDate, Date endDate)
  2. getDayOfDate(Date date)
  3. getDayOfThisYear(Date currentdate)
  4. getDayOfYear(Date date)
  5. getDays(Date t, Date baseDate)
  6. getDayShort(Date date)
  7. getDaysMin(Date d)
  8. getDaysPassedSince(Date dateLastModified)
  9. getDayStart(Date date)