Here you can find the source of getMonthEndDate(int year, int month)
public static Date getMonthEndDate(int year, int month)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date getMonthEndDate(int year, int month) { Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, year); c.set(Calendar.MONTH, month); c.set(Calendar.DAY_OF_MONTH, 0); c.set(Calendar.HOUR_OF_DAY, 23); c.set(Calendar.MINUTE, 59); c.set(Calendar.SECOND, 59); return c.getTime(); }/*from w w w.j ava 2s . c om*/ public static long getTime() { return (new java.util.Date()).getTime(); } }