code: public static long[] getTimeDifference(Date d1, Date d2) {
  		long[] result = new long[5];
  
  		Calendar cal = Calendar.getInstance();
  		cal.setTime(d1);
  		long t1 = cal.getTimeInMillis();
  
  		cal.setTime(d2);
  
  		long diff = Math.abs(cal.getTimeInMillis() - t1);
  		final int ONE_DAY = 1000 * 60 * 60 * 24;
  		final int ONE_HOUR = ONE_DAY / 24;
  		final int ONE_MINUTE = ONE_HOUR / 60;
  		final int ONE_SECOND = ONE_MINUTE / 60;
  
  		long d = diff / ONE_DAY;
  		diff %= ONE_DAY;
  
  		long h = diff / ONE_HOUR;
  		diff %= ONE_HOUR;
  
  		long m = diff / ONE_MINUTE;
  		diff %= ONE_MINUTE;
  
  		long s = diff / ONE_SECOND;
  		long ms = diff % ONE_SECOND;
  		result[0] = d;
  		result[1] = h;
  		result[2] = m;
  		result[3] = s;
  		result[4] = ms;
  
  		return result;
  	}
docs: Calculates the date/time difference of two date object.
  
  @param d1
  a starting date
  @param d2
  an end date
  @return an array where the 0th element has the number of days, the 1st element the number of hours, the 2nd
  element the number of minutes, the 3rd element the number of seconds, the 4th element the number of
  millis.