Java Date Previous getPreviousMonthFirst(Date appointDate)

Here you can find the source of getPreviousMonthFirst(Date appointDate)

Description

get Previous Month First

License

Open Source License

Declaration

public static Date getPreviousMonthFirst(Date appointDate) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {

    public static Date getPreviousMonthFirst(Date appointDate) {
        Calendar appointCalendar = Calendar.getInstance();
        appointCalendar.setTime(appointDate);
        Calendar lastDate = Calendar.getInstance();
        lastDate.set(Calendar.DATE, 1);//
        lastDate.set(Calendar.MONTH, appointCalendar.get(Calendar.MONTH) - 1);
        lastDate.set(Calendar.YEAR, appointCalendar.get(Calendar.YEAR));
        return lastDate.getTime();
    }/*  w w  w  .j a v  a 2 s . c  o  m*/
}

Related

  1. getPreviousDay(Date inputDate)
  2. getPreviousFriday(final Date d)
  3. getPreviousMonday(Date day)
  4. getPreviousMonth(Date time)
  5. getPreviousMonth(long date)
  6. getPreviousQuarterStartDate(Date dt)
  7. getPreviuosRoundMonth(Date baseDate)
  8. previousDay(Date date)
  9. previousDay(long date)