Android Month String Get getMonthBefore(String format)

Here you can find the source of getMonthBefore(String format)

Description

get Month Before

Declaration

public static String getMonthBefore(String format) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static String getMonthBefore(String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        Calendar c = Calendar.getInstance();
        c.setTime(new Date());
        c.add(Calendar.MONTH, -1);
        return sdf.format(c.getTime());
    }//ww w .  j  a  va  2 s.co m
}

Related

  1. getCurMonthStr()
  2. getLastMonthStr()
  3. getMonthString(int month, int abbrev)
  4. getMonthStringByIndex(int index)
  5. getReadableMonth(int month)
  6. getCurrentMonth()