Java Date Previous getPreviousMonth(Date time)

Here you can find the source of getPreviousMonth(Date time)

Description

get Previous Month

License

Open Source License

Declaration

public static Date getPreviousMonth(Date time) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static Date getPreviousMonth(Date time) {
        Calendar calendar = Calendar.getInstance();
        if (null != time) {
            calendar.setTimeInMillis(time.getTime());
        }//from ww  w  .  j av a  2 s. c o  m
        calendar.add(Calendar.MONTH, -1);
        return new Date(calendar.getTimeInMillis());
    }
}

Related

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