Util.java Source code

Java tutorial

Introduction

Here is the source code for Util.java

Source

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

public class Util {
    public static Date getLastMonthLastDate() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MONTH, -1);

        int max = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
        calendar.set(Calendar.DAY_OF_MONTH, max);

        return calendar.getTime();
    }
}