Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static long getEndOfCurrentMonth() { Calendar calendar = getCurrentCalendar(); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); return calendar.getTimeInMillis(); } public static Calendar getCurrentCalendar() { return getCalendarWithTime(System.currentTimeMillis()); } public static Calendar getCalendarWithTime(long time) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time); return calendar; } }