Java Date Previous getPreviousMonday(Date day)

Here you can find the source of getPreviousMonday(Date day)

Description

get Previous Monday

License

Apache License

Declaration

public static Date getPreviousMonday(Date day) 

Method Source Code

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

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

public class Main {
    public static Date getPreviousMonday(Date day) {
        Calendar previousMonday = Calendar.getInstance();
        previousMonday.setTime(day);/*from  w  w  w.  j a  va 2s.c om*/
        previousMonday.set(Calendar.HOUR_OF_DAY, 0);
        previousMonday.set(Calendar.MINUTE, 0);
        previousMonday.set(Calendar.SECOND, 0);
        previousMonday.add(Calendar.DATE, -1);
        previousMonday.add(Calendar.WEEK_OF_MONTH, -1);
        previousMonday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        return previousMonday.getTime();
    }
}

Related

  1. getPreviousDateStart()
  2. getPreviousDay(Date date)
  3. getPreviousDay(Date dateTime)
  4. getPreviousDay(Date inputDate)
  5. getPreviousFriday(final Date d)
  6. getPreviousMonth(Date time)
  7. getPreviousMonth(long date)
  8. getPreviousMonthFirst(Date appointDate)
  9. getPreviousQuarterStartDate(Date dt)