get Finish Current Month - Java java.util

Java examples for java.util:Month

Description

get Finish Current Month

Demo Code


import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;

public class Main{
    public static void main(String[] argv) throws Exception{
        System.out.println(getFinishCurrentMonth());
    }//from   w w w. j  a  v a2 s .c  o m
    public static Date getFinishCurrentMonth() {
        Calendar calendar = Calendar.getInstance();
        return CalendarsUtils.getFinishMonth(calendar.get(Calendar.MONTH));
    }
    public static Date getFinishMonth(int month) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.MONTH, month);
        calendar.set(Calendar.DAY_OF_MONTH,
                calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
        return calendar.getTime();
    }
}

Related Tutorials