Here you can find the source of maximizeTime(Calendar cal)
Parameter | Description |
---|---|
cal | a parameter |
public static void maximizeTime(Calendar cal)
//package com.java2s; /*/*from w ww . j a v a 2 s . c o m*/ * 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 2 * 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import java.util.*; public class Main { /** * Set the time of a calendar to 23:59:59.999 * * @param cal */ public static void maximizeTime(Calendar cal) { // #1753473: thx to Uriah/umlsdl for pointing this out cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); } /** * Set the time of a date to 23:59:59.999 */ public static Date maximizeTime(Date date) { Calendar cal = new GregorianCalendar(); cal.setTime(date); maximizeTime(cal); return cal.getTime(); } }