List of utility methods to do Date Difference
long | dayDiff(Date date1, Date date2) day Diff return (date2.getTime() - date1.getTime()) / 86400000;
|
int | dayDiff(Date first, Date second) day Diff long msPerDay = 1000 * 60 * 60 * 24; long diff = (first.getTime() / msPerDay) - (second.getTime() / msPerDay); Long convertLong = new Long(diff); return convertLong.intValue(); |
long | dayDiffByStartOfDay(Date a, Date b) day Diff By Start Of Day a = startOfDay(a);
b = startOfDay(b);
return dayDiff(a, b);
|
long | daysDiff(Date d1, Date d2) days Diff long t1 = d1.getTime(); long t2 = d2.getTime(); return (t1 - t2) / (1000 * 60 * 60 * 24); |
long | diff(Date d1, Date d2) Return the millisecond difference between two Date s.
return d1.getTime() - d2.getTime();
|
int | diff(Date date1, Date date2) diff Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTime(date1); c2.setTime(date2); int diffDay = 0; if (c1.before(c2)) { diffDay = countDiffDay(c1, c2); } else { ... |
int | diff(Date date1, Date date2) diff long day = 24L * 60L * 60L * 1000L; String str1 = date2Str(date1, "yyyy-MM-dd"); date1 = str2Date(str1, "yyyy-MM-dd"); String str2 = date2Str(date2, "yyyy-MM-dd"); date2 = str2Date(str2, "yyyy-MM-dd"); return (int) (((date2.getTime() - date1.getTime()) / day)); |
long | diff(Date endDate, Date startDate) diff long endTime = getMillis(endDate); long startTime = getMillis(startDate); return endTime - startTime; |
long | diff(Date sDate, Date fDate) diff long timeDiff = fDate.getTime() - sDate.getTime(); return timeDiff; |
long | diff(Date subtrahend, Date minuend, long diffField) diff long diff = minuend.getTime() - subtrahend.getTime(); return diff / diffField; |