@Test public void testSubtimeBurst() throws ParseException { assertEquals("计算有误", DateUtil.subtimeBurst("2015-06-24 08:00:00", "2015-06-23 20:24:00", "08:00-21:00"), -2160); assertEquals("计算有误", DateUtil.subtimeBurst("2015-01-05 08:00:00", "2015-01-05 08:00:30", "08:00-21:00"), 30); assertEquals("计算有误", DateUtil.subtimeBurst("2015-01-05 20:59:01", "2015-01-05 21:00:00", "08:00-21:00"), 59); assertEquals("计算有误", DateUtil.subtimeBurst("2015-01-05 21:00:00", "2015-01-05 22:00:00", "08:00-21:00"), 0); assertEquals("计算有误", DateUtil.subtimeBurst("2015-01-05 20:59:02", "2015-01-06 21:00:00", "08:00-21:00"), 58L + (21 - 8) * 60 * 60); assertEquals("计算有误", DateUtil.subtimeBurst("2015-01-05 20:59:02", "2015-01-07 08:00:57", "08:00-21:00"), (21 - 8) * 3600 + 115L); assertEquals("计算有误", DateUtil.subtimeBurst("2016-03-08 14:37:03", "2016-03-09 09:37:03", "08:30-17:30"), 4 * 60 * 60); }
public static long subtimeBurst(String startDate, String endDate, String timeBurst) throws ParseException { Date start = DateTimeInstance().parse(startDate); Date end = DateTimeInstance().parse(endDate); return subtimeBurst(start, end, timeBurst); }
DateUtil { public static long subtimeBurst(String startDate, String endDate, String timeBurst) throws ParseException { Date start = DateTimeInstance().parse(startDate); Date end = DateTimeInstance().parse(endDate); return subtimeBurst(start, end, timeBurst); } }
DateUtil { public static long subtimeBurst(String startDate, String endDate, String timeBurst) throws ParseException { Date start = DateTimeInstance().parse(startDate); Date end = DateTimeInstance().parse(endDate); return subtimeBurst(start, end, timeBurst); }  }
DateUtil { public static long subtimeBurst(String startDate, String endDate, String timeBurst) throws ParseException { Date start = DateTimeInstance().parse(startDate); Date end = DateTimeInstance().parse(endDate); return subtimeBurst(start, end, timeBurst); }  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); }
DateUtil { public static long subtimeBurst(String startDate, String endDate, String timeBurst) throws ParseException { Date start = DateTimeInstance().parse(startDate); Date end = DateTimeInstance().parse(endDate); return subtimeBurst(start, end, timeBurst); }  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);  }