Here you can find the source of getDateEnd(java.util.Date d)
public static java.util.Date getDateEnd(java.util.Date d)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static java.util.Date getDateEnd(java.util.Date d) { Calendar c = Calendar.getInstance(); c.clear();/*w ww . ja v a 2 s . co m*/ 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(); } }