private static void addDays(Date date, int days) { CalendarUtil.addDaysToDate(date, days); // We might hit DST transition. Try reseting back so follow up days continue showing midnight. CalendarUtil.resetTime(date); }
/** * Sets a date object to be at the beginning of the month and no time * specified. * * @param date the date */ @SuppressWarnings("deprecation") // GWT requires Date public static void setToFirstDayOfMonth(Date date) { resetTime(date); date.setDate(1); }
/** * Returns the number of days between the two dates. Time is ignored. * * @param start starting date * @param finish ending date * @return the different */ public static int getDaysBetween(Date start, Date finish) { // Convert the dates to the same time start = copyDate(start); resetTime(start); finish = copyDate(finish); resetTime(finish); long aTime = start.getTime(); long bTime = finish.getTime(); long adjust = 60 * 60 * 1000; adjust = (bTime > aTime) ? adjust : -adjust; return (int) ((bTime - aTime + adjust) / (24 * 60 * 60 * 1000)); }
/** * Sets a date object to be at the beginning of the month and no time * specified. * * @param date the date */ @SuppressWarnings("deprecation") // GWT requires Date public static void setToFirstDayOfMonth(Date date) { resetTime(date); date.setDate(1); }
/** * Sets a date object to be at the beginning of the month and no time * specified. * * @param date the date */ @SuppressWarnings("deprecation") // GWT requires Date public static void setToFirstDayOfMonth(Date date) { resetTime(date); date.setDate(1); }
private static void addDays(Date date, int days) { CalendarUtil.addDaysToDate(date, days); // We might hit DST transition. Try reseting back so follow up days continue showing midnight. CalendarUtil.resetTime(date); }
/** * Returns the number of days between the two dates. Time is ignored. * * @param start starting date * @param finish ending date * @return the different */ public static int getDaysBetween(Date start, Date finish) { // Convert the dates to the same time start = copyDate(start); resetTime(start); finish = copyDate(finish); resetTime(finish); long aTime = start.getTime(); long bTime = finish.getTime(); long adjust = 60 * 60 * 1000; adjust = (bTime > aTime) ? adjust : -adjust; return (int) ((bTime - aTime + adjust) / (24 * 60 * 60 * 1000)); }
/** * Returns the number of days between the two dates. Time is ignored. * * @param start starting date * @param finish ending date * @return the different */ public static int getDaysBetween(Date start, Date finish) { // Convert the dates to the same time start = copyDate(start); resetTime(start); finish = copyDate(finish); resetTime(finish); long aTime = start.getTime(); long bTime = finish.getTime(); long adjust = 60 * 60 * 1000; adjust = (bTime > aTime) ? adjust : -adjust; return (int) ((bTime - aTime + adjust) / (24 * 60 * 60 * 1000)); }