Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static java.util.Date getDateEnd(java.util.Date d) { Calendar c = Calendar.getInstance(); c.clear(); Calendar co = Calendar.getInstance(); co.setTime(d); c.set(Calendar.DAY_OF_MONTH, co.get(Calendar.DAY_OF_MONTH)); c.set(Calendar.MONTH, co.get(Calendar.MONTH)); c.set(Calendar.YEAR, co.get(Calendar.YEAR)); c.add(Calendar.DAY_OF_MONTH, 1); c.add(Calendar.MILLISECOND, -1); return c.getTime(); } }