Java Day of Week getLastWeekDate(Date date)

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

Description

get Last Week Date

License

Apache License

Declaration

public static Date getLastWeekDate(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static int FIRST_DAY_OF_WEEK = Calendar.MONDAY;

    public static Date getLastWeekDate(Date date) {
        Calendar c = getCalendar();
        c.setTime(date);//from   w  w w.j av  a2 s  .com
        c.add(Calendar.WEEK_OF_YEAR, -1);
        return c.getTime();
    }

    private static Calendar getCalendar() {
        Calendar c = Calendar.getInstance();
        c.setFirstDayOfWeek(FIRST_DAY_OF_WEEK);
        return c;
    }
}

Related

  1. getLastDayOfWeek(Date date)
  2. getLastDayOfWeek(Date date)
  3. getLastDayOfWeek(String str, int week)
  4. getLastDayWeek(String s)
  5. getLastMondayOfWeek(Date date)
  6. getLastWeekDay(int weekDay, Date end)
  7. getMondayFirstOfWeek(Date baseDate)
  8. getMondayOfThisWeek(Date date)
  9. getMondayOfWeek(Date date)