List of utility methods to do Calendar Between
int | daysBetween(Calendar early, Calendar late) Returns the days between two dates. return (int) (toJulian(late) - toJulian(early)); |
int | daysBetween(Calendar early, Calendar late) days Between return (int) (toJulian(late) - toJulian(early)); |
int | daysBetween(Calendar fromCalendar, Calendar untilCalendar) days Between return julianDay(untilCalendar.get(Calendar.YEAR), untilCalendar.get(Calendar.MONTH) + 1,
untilCalendar.get(Calendar.DAY_OF_MONTH))
- julianDay(fromCalendar.get(Calendar.YEAR), fromCalendar.get(Calendar.MONTH) + 1,
fromCalendar.get(Calendar.DAY_OF_MONTH));
|
long | daysBetween(Calendar fromDate, Calendar toDate) days Between return Math.round((toDate.getTimeInMillis() - fromDate.getTimeInMillis()) / (1000 * 60 * 60 * 24));
|
long | daysBetween(Calendar start, Calendar end) days Between GregorianCalendar startDate = new GregorianCalendar(Locale.getDefault()); GregorianCalendar endDate = new GregorianCalendar(Locale.getDefault()); startDate.setGregorianChange(new Date(Long.MAX_VALUE)); endDate.setGregorianChange(new Date(Long.MAX_VALUE)); startDate.setTime(start.getTime()); endDate.setTime(end.getTime()); startDate.set(Calendar.HOUR_OF_DAY, 12); endDate.set(Calendar.HOUR_OF_DAY, 12); ... |
int | daysBetween(Calendar startTime, Calendar endTime) days Between if (startTime == null) { throw new IllegalArgumentException("startTime is null"); if (endTime == null) { throw new IllegalArgumentException("endTime is null"); if (startTime.compareTo(endTime) > 0) { throw new IllegalArgumentException("endTime is before the startTime"); ... |
int | daysBetween(final Calendar cal1, final Calendar cal2) days Between final Calendar from, to; boolean positive = true; if (cal1.getTimeInMillis() < cal2.getTimeInMillis()) { from = cal1; to = cal2; } else { from = cal2; to = cal1; ... |
long | daysBetween(final Calendar startDate, final Calendar endDate) days Between long days = 0; while (endDate.after(startDate)) { endDate.add(Calendar.DATE, -1); ++days; return days; |
long | daysBetween(final Calendar startDate, final Calendar endDate) Determines the number of days between two dates in Calendar objects Calendar sDate = (Calendar) startDate.clone(); long daysBetween = 0; int y1 = sDate.get(Calendar.YEAR); int y2 = endDate.get(Calendar.YEAR); int m1 = sDate.get(Calendar.MONTH); int m2 = endDate.get(Calendar.MONTH); while (((y2 - y1) * 12 + (m2 - m1)) > 12) { if (sDate.get(Calendar.MONTH) == Calendar.JANUARY ... |
long | daysBetweenCalendarDates(final Calendar firstDate, final Calendar secondDate) days Between Calendar Dates return ((secondDate.getTimeInMillis() - firstDate.getTimeInMillis()) / (1000 * 60 * 60 * 24));
|