@Test public void testGetDateDifferenceInMinutes() throws Exception { Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone("UTC")); calendar.set(Calendar.YEAR, 2013); calendar.set(Calendar.MONTH, Calendar.NOVEMBER); calendar.set(Calendar.DAY_OF_MONTH, 18); calendar.set(Calendar.HOUR_OF_DAY, 14); calendar.set(Calendar.MINUTE, 49); calendar.set(Calendar.SECOND, 29); calendar.set(Calendar.MILLISECOND, 0); String time = "2013-11-18T14:29:29-0000"; Date date = DateUtils.convertToDate(time); Long diff = (Math.abs(date.getTime() - calendar.getTimeInMillis())) / (60 * 1000) % 60; Assert.assertEquals(Long.valueOf(20L).longValue(), diff.longValue()); }
public static Long getDateDifferenceInMinutes(Date oldTime) { long diff = Math.abs(oldTime.getTime() - new Date().getTime()); return diff / (60 * 1000) % 60; }
DateUtils { public static Long getDateDifferenceInMinutes(Date oldTime) { long diff = Math.abs(oldTime.getTime() - new Date().getTime()); return diff / (60 * 1000) % 60; } }
DateUtils { public static Long getDateDifferenceInMinutes(Date oldTime) { long diff = Math.abs(oldTime.getTime() - new Date().getTime()); return diff / (60 * 1000) % 60; }  }
DateUtils { public static Long getDateDifferenceInMinutes(Date oldTime) { long diff = Math.abs(oldTime.getTime() - new Date().getTime()); return diff / (60 * 1000) % 60; }  static String convertToReadableTime(Long timestamp); static Long convertToTimestamp(String time, String format); static Date convertToDate(String date); static String convertDateToString(Date date); static Long getDateDifferenceInMinutes(Date oldTime); static boolean isFutureTime(Date time); static Date getDateSpecifiedTimeAgo(String periodString); }
DateUtils { public static Long getDateDifferenceInMinutes(Date oldTime) { long diff = Math.abs(oldTime.getTime() - new Date().getTime()); return diff / (60 * 1000) % 60; }  static String convertToReadableTime(Long timestamp); static Long convertToTimestamp(String time, String format); static Date convertToDate(String date); static String convertDateToString(Date date); static Long getDateDifferenceInMinutes(Date oldTime); static boolean isFutureTime(Date time); static Date getDateSpecifiedTimeAgo(String periodString); static final String ALLOWED_DATE_FORMAT; }