Android Day Get getBeforeDate(Date date, int days)

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

Description

get Before Date

Declaration

public static String getBeforeDate(Date date, int days) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {
    public static String getBeforeDate(Date date, int days) {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);//from  w  ww .j a v a 2 s.  co m
        calendar.set(Calendar.DAY_OF_YEAR,
                calendar.get(Calendar.DAY_OF_YEAR) - days);
        return df.format(calendar.getTime());
    }
}

Related

  1. getNextDateForDay(int calendarDay)
  2. getHashByDay(String date)
  3. getJulianDay(Calendar cal)
  4. getIntervalDays(String sd, String ed)
  5. isBirthday(Calendar cal)
  6. getAfterDate(Date date, int days)
  7. fromJulianDay(double julianDay)
  8. getTimeNextDay(long lTimeMillis)
  9. getDaysTo(Date date)