Here you can find the source of getDayEnd(Date date)
Parameter | Description |
---|---|
date | Date to use in calculation |
public static Date getDayEnd(Date date)
//package com.java2s; /* /* w w w . ja va 2 s . c o m*/ * Copyright (C) 2014 Alex Pavlunenko <alexp at xpresstek.net> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /** * Calculates end of the day * * @param date Date to use in calculation * @return Date with hour set to 23 min and sec set to 59 */ public static Date getDayEnd(Date date) { Calendar end = new GregorianCalendar(); end.setTime(date); end.set(Calendar.HOUR_OF_DAY, 23); end.set(Calendar.MINUTE, 59); end.set(Calendar.SECOND, 59); return end.getTime(); } }