Android Week Get getDateAWeekAgo(Date date)

Here you can find the source of getDateAWeekAgo(Date date)

Description

get Date A Week Ago

Declaration

public static Date getDateAWeekAgo(Date date) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static Date getDateAWeekAgo(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);// w  ww .j  av a  2 s.  c  o  m

        c.add(Calendar.DAY_OF_MONTH, -7);

        Date ret = c.getTime();

        return ret;
    }
}

Related

  1. getDateInAWeek(Date date)
  2. getWeeksSinceEpochFromJulianDay(int julianDay, int firstDayOfWeek)
  3. getStartAndEndDatesForWeek(Calendar currentDate, Calendar startDate, Calendar endDate)
  4. getDaysOfWeekNames()