Java tutorial
import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] args) { System.out.println(getTheEndOfDate(new Date())); } public static Date getTheEndOfDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MILLISECOND, 999); return calendar.getTime(); } }