@Test public void testEndOfDay() throws Exception { Calendar cal = Calendar.getInstance(); Date date = DateHelper.endOfDay(cal.getTime()); assertEquals(23, date.getHours()); assertEquals(59, date.getMinutes()); assertEquals(59, date.getSeconds()); assertEquals(1900 + date.getYear(), cal.get(Calendar.YEAR)); assertEquals(date.getMonth(), cal.get(Calendar.MONTH)); assertEquals(date.getDate(), cal.get(Calendar.DAY_OF_MONTH)); }
public static Date endOfDay(Date dt) { Calendar cal = Calendar.getInstance(); cal.setTime(dt); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 59); return cal.getTime(); }
DateHelper { public static Date endOfDay(Date dt) { Calendar cal = Calendar.getInstance(); cal.setTime(dt); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 59); return cal.getTime(); } }
DateHelper { public static Date endOfDay(Date dt) { Calendar cal = Calendar.getInstance(); cal.setTime(dt); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 59); return cal.getTime(); } private  DateHelper(); }
DateHelper { public static Date endOfDay(Date dt) { Calendar cal = Calendar.getInstance(); cal.setTime(dt); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 59); return cal.getTime(); } private  DateHelper(); static String format(Date dt); static String format(Date dt, String pattern); static String formatShortDate(Date dt); static String formatShortTime(Date dt); static String formatISO8601(Date dt); static Calendar getEmptyCalendar(); static Calendar calendar(int year, int month, int day); static Date date(int year, int month, int day); static Date beginOfDay(Date dt); static Date endOfDay(Date dt); static int diffDays(Date dtEnd, Date dtBegin); static Date setTime(Date date, Date time); static Date getTime(Date datetime); static boolean isOnlyTime(Date dt); static boolean isOnlyDate(Date dt); static Date addDays(Date date, int count); static boolean isEmpty(Date date); static String[] getWeekdays(); static String[] getShortWeekdays(); static int[] getIndexWeekdays(); }
DateHelper { public static Date endOfDay(Date dt) { Calendar cal = Calendar.getInstance(); cal.setTime(dt); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 59); return cal.getTime(); } private  DateHelper(); static String format(Date dt); static String format(Date dt, String pattern); static String formatShortDate(Date dt); static String formatShortTime(Date dt); static String formatISO8601(Date dt); static Calendar getEmptyCalendar(); static Calendar calendar(int year, int month, int day); static Date date(int year, int month, int day); static Date beginOfDay(Date dt); static Date endOfDay(Date dt); static int diffDays(Date dtEnd, Date dtBegin); static Date setTime(Date date, Date time); static Date getTime(Date datetime); static boolean isOnlyTime(Date dt); static boolean isOnlyDate(Date dt); static Date addDays(Date date, int count); static boolean isEmpty(Date date); static String[] getWeekdays(); static String[] getShortWeekdays(); static int[] getIndexWeekdays(); static final String DATE_FORMAT_ISO8601; }