get Last Month Year Value - Java java.util

Java examples for java.util:Month

Description

get Last Month Year Value

Demo Code


//package com.java2s;

import java.util.Calendar;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getLastMonthYearValue());
    }/*from   ww w  .  j  av  a2  s. com*/

    public static int getLastMonthYearValue() {
        Calendar temp = Calendar.getInstance();
        temp.add(Calendar.MONTH, -1);
        return temp.get(Calendar.YEAR);
    }
}

Related Tutorials