Java Month Get getBeforeMonth(int amount)

Here you can find the source of getBeforeMonth(int amount)

Description

get Before Month

License

Open Source License

Declaration


public static String getBeforeMonth(int amount) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {

    public static String getBeforeMonth(int amount) {
        SimpleDateFormat daytime = new SimpleDateFormat("yyyyMM");
        Calendar cal = Calendar.getInstance();
        cal.setTime(cal.getTime());//  w w w  .j a va 2  s.c om
        cal.add(Calendar.MONTH, -amount);
        String month = daytime.format(cal.getTime());
        return month;

    }
}

Related

  1. currentMonth()
  2. currentMonthStr()
  3. getAktMonthName()
  4. getAllMonths(String date1, String date2)
  5. getBeforeOrAfterDate(String strDate, int months)
  6. getCurMonth2Long()
  7. getCurrMonthLastDay()
  8. getEndDateOfMonth(String yyyymmdd)