Here you can find the source of getDateScopeAfterMonth(int year, int month)
public static Date[] getDateScopeAfterMonth(int year, int month)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date[] getDateScopeAfterMonth(int year, int month) { Date[] date = new Date[2]; Calendar cal = new GregorianCalendar(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month - 1); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.HOUR_OF_DAY, cal.getActualMinimum(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, cal.getActualMinimum(Calendar.MINUTE)); cal.set(Calendar.SECOND, cal.getActualMinimum(Calendar.SECOND)); cal.set(Calendar.MILLISECOND, cal.getActualMinimum(Calendar.MILLISECOND)); date[0] = cal.getTime();/*ww w. j av a 2 s . c o m*/ cal.set(Calendar.MONTH, cal.getActualMaximum(Calendar.MONTH)); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); cal.set(Calendar.HOUR_OF_DAY, cal.getActualMaximum(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, cal.getActualMaximum(Calendar.MINUTE)); cal.set(Calendar.SECOND, cal.getActualMaximum(Calendar.SECOND)); cal.set(Calendar.MILLISECOND, cal.getActualMaximum(Calendar.MILLISECOND)); date[1] = cal.getTime(); return date; } }