### Question:
DateUtil { public static long subtract(Date date1, Date date2) { long cha = (date2.getTime() - date1.getTime()) / 1000; return cha; }  static String currentDateTime(); static String dateTime(Date date); static Date dateTime(String datestr); static String currentDate(); static String date(Date date); static Date date(String dateStr); static String currentTime(); static String time(Date date); static Date time(String dateStr); static Date year(int year); static Date year(Date date, int year); static Date month(int month); static Date month(Date date, int month); static Date day(int day); static Date day(Date date, int day); static Date hour(float hour); static Date hour(Date date, float hour); static Date minute(int minute); static Date minute(Date date, int minute); static boolean isDate(String date); static long subtract(Date date1, Date date2); static long subtract(String date1, String date2); static int subtractMinute(String date1, String date2); static int subtractMinute(Date date1, Date date2); static int subtractHour(Date date1, Date date2); static int subtractHour(String date1, String date2); static int subtractDay(String date1, String date2); static int subtractDay(Date date1, Date date2); static int subtractMonth(String date1, String date2); static int subtractMonth(Date date1, Date date2); static int subtractYear(String date1, String date2); static int subtractYear(Date date1, Date date2); static String subtractTime(String date1, String date2); static String subtractDate(String date1, String date2); static int subDay(Date startTime, Date endTime); static int subDay(String startTime, String endTime); static long subtimeBurst(String startDate, String endDate, String timeBurst); static long subtimeBurst(Date startDate, Date endDate, String timeBurst); static Date calculate(String date, int second, String timeBurst); static Date calculate(Date date, int second, String timeBurst); static boolean between(String startTime, String endTime, Date date); static boolean between(Date startTime, Date endTime, Date date);  }### Answer:
@Test public void testSubtract1() throws Exception { String str1 = "2015-02-23 18:54:00"; String str2 = "2015-02-23 18:55:22"; long rs = DateUtil.subtract(sdf.parse(str1), sdf.parse(str2)); assertEquals("计算有误", 82L, rs); }
@Test public void testSubtract() { String str1 = "2015-02-23 18:54:00"; String str2 = "2015-02-23 18:55:22"; long rs = DateUtil.subtract(str1, str2); System.out.println(rs); assertEquals("计算有误", 82L, rs); }