List of utility methods to do Date Between
long | between(Date beginDate, Date endDate) between Calendar calBegin = Calendar.getInstance(); Calendar calEnd = Calendar.getInstance(); calBegin.setTime(beginDate); calEnd.setTime(endDate); calBegin.clear(14); calEnd.clear(14); long millisecs = calBegin.getTime().getTime() - calEnd.getTime().getTime(); long remainder = millisecs % 0x5265c00L; ... |
boolean | between(Date d, Date startDate, Date endDate) Checks whether the given d, is greater than or equal to startDate and less than or equal to endDate. if (endDate == null) { return compareDate(d, startDate) >= 0; } else if (compareDate(endDate, d) == 0) { return false; } else { return compareDate(d, startDate) >= 0 && compareDate(d, endDate) <= 0; |
boolean | between(Date kezdet, Date veg, Date datum) between if (datum == null || kezdet == null || veg == null) { return false; Date day = startOfDay(datum); return !day.before(startOfDay(kezdet)) && !day.after(startOfDay(veg)); |
boolean | between(Date since, Date until, Date dateIn, Date dateOut) between return between(dateIn, dateOut, since) || between(dateIn, dateOut, until)
|| (since.before(dateIn) && until.after(dateOut));
|
int | between(Date smdate, Date bdate) between Calendar cal = Calendar.getInstance(); cal.setTime(smdate); long time1 = cal.getTimeInMillis(); cal.setTime(bdate); long time2 = cal.getTimeInMillis(); long between_days = (time2 - time1) / (1000 * 3600 * 24); return Integer.parseInt(String.valueOf(between_days)); |
long | betweenDate(String from, String to) between date if (from == null) { throw new IllegalArgumentException("from can not be null"); if (to == null) { throw new IllegalArgumentException("to can not be null"); int len = from.length(); if (!(len == 8 || len == 14)) { ... |
boolean | betweenHour(Date date, int hour) between Hour Calendar calendar = getCalendarFromDate(date);
calendar.add(Calendar.HOUR, hour);
Calendar now = getDefaultCalendar();
return calendar.after(now);
|
boolean | betweenInDay(Date date, Date start, Date end) check id a date in between two other date, but date in range. return isAfterOrEqualForDay(date, start) && isBeforeOrEqualForDay(date, end);
|
boolean | betweenStartDateAndEndDate(Date startDate, Date endDate) between Start Date And End Date boolean bool = false; Date curDate = new Date(); if ((curDate.after(startDate)) && (curDate.before(dateAdd(1, endDate, 1)))) { bool = true; return bool; |
boolean | betweenStrict(Date kezdet, Date datum, Date veg) between Strict if (datum == null) { return false; if (kezdet != null && datum.before(kezdet)) { return false; if (veg != null && datum.after(veg)) { return false; ... |