Here you can find the source of getEndTimeStampOfDate(Date date)
public static Date getEndTimeStampOfDate(Date date)
//package com.java2s; /**// w w w .j a va 2 s .c o m * Copyright (c) 2008 OpenSprout Team. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * */ import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.GregorianCalendar; import java.util.StringTokenizer; public class Main { public static Date getEndTimeStampOfDate(Date date) { if (date == null) return null; String yyyymmdd = makeYYYYMMDD(date); StringTokenizer tokenizer = new StringTokenizer(yyyymmdd, "/"); int year = Integer.parseInt(tokenizer.nextToken()); int month = Integer.parseInt(tokenizer.nextToken()); int day = Integer.parseInt(tokenizer.nextToken()); return new Timestamp(makeDateTime(year, month, day, 23, 59, 59).getTime()); } public static String makeYYYYMMDD(Date date) { DateFormat format = new SimpleDateFormat("yyyy/MM/dd"); return format.format(date); } public static Date makeDateTime(int year, int month, int day, int hour, int minute, int second) { return new GregorianCalendar(year, month - 1, day, hour, minute, second).getTime(); } }