@Test public void testDuration() { Calendar calendar1 = Calendar.getInstance(); calendar1.set(2017, 2, 21, 15, 35); Calendar calendar2 = Calendar.getInstance(); calendar2.set(2017, 2, 21, 18, 56); Date date1 = calendar1.getTime(); Date date2 = calendar2.getTime(); String humanString = DateUtils.getDuration(date1, date2); assertThat(humanString, is("03:21")); }
public static String getDuration(Date dateBegin, Date dateEnd) { return DurationFormatUtils.formatDuration(dateEnd.getTime()-dateBegin.getTime(), "HH:mm", true); }
DateUtils { public static String getDuration(Date dateBegin, Date dateEnd) { return DurationFormatUtils.formatDuration(dateEnd.getTime()-dateBegin.getTime(), "HH:mm", true); } }
DateUtils { public static String getDuration(Date dateBegin, Date dateEnd) { return DurationFormatUtils.formatDuration(dateEnd.getTime()-dateBegin.getTime(), "HH:mm", true); }  }
DateUtils { public static String getDuration(Date dateBegin, Date dateEnd) { return DurationFormatUtils.formatDuration(dateEnd.getTime()-dateBegin.getTime(), "HH:mm", true); }  static String formatCompleteDate(Date date); static String formatOnlyDay(Date date); static String formatFilenameDate(Date date); static String formatDateForMongo(Date date); static String getDuration(Date dateBegin, Date dateEnd); static Date getLastTimeFromDate(Date date); }
DateUtils { public static String getDuration(Date dateBegin, Date dateEnd) { return DurationFormatUtils.formatDuration(dateEnd.getTime()-dateBegin.getTime(), "HH:mm", true); }  static String formatCompleteDate(Date date); static String formatOnlyDay(Date date); static String formatFilenameDate(Date date); static String formatDateForMongo(Date date); static String getDuration(Date dateBegin, Date dateEnd); static Date getLastTimeFromDate(Date date);  }