@Test public void isNowBetweenTimeSpanOfDay() { TimeUtil.isNowBetweenTimeSpanOfDay("21:31","06:00"); }
public static boolean isNowBetweenTimeSpanOfDay(String startHourMin, String endHourMin){ Calendar now = Calendar.getInstance(); Calendar start = (Calendar) now.clone(); start.set(Calendar.HOUR_OF_DAY, Integer.parseInt(startHourMin.split(":")[0])); start.set(Calendar.MINUTE, Integer.parseInt(startHourMin.split(":")[1])); Calendar end = (Calendar) now.clone(); end.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH) + 1); end.set(Calendar.HOUR_OF_DAY, Integer.parseInt(endHourMin.split(":")[0])); end.set(Calendar.MINUTE, Integer.parseInt(endHourMin.split(":")[1])); return now.after(start) && now.before(end); }
TimeUtil { public static boolean isNowBetweenTimeSpanOfDay(String startHourMin, String endHourMin){ Calendar now = Calendar.getInstance(); Calendar start = (Calendar) now.clone(); start.set(Calendar.HOUR_OF_DAY, Integer.parseInt(startHourMin.split(":")[0])); start.set(Calendar.MINUTE, Integer.parseInt(startHourMin.split(":")[1])); Calendar end = (Calendar) now.clone(); end.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH) + 1); end.set(Calendar.HOUR_OF_DAY, Integer.parseInt(endHourMin.split(":")[0])); end.set(Calendar.MINUTE, Integer.parseInt(endHourMin.split(":")[1])); return now.after(start) && now.before(end); } }
TimeUtil { public static boolean isNowBetweenTimeSpanOfDay(String startHourMin, String endHourMin){ Calendar now = Calendar.getInstance(); Calendar start = (Calendar) now.clone(); start.set(Calendar.HOUR_OF_DAY, Integer.parseInt(startHourMin.split(":")[0])); start.set(Calendar.MINUTE, Integer.parseInt(startHourMin.split(":")[1])); Calendar end = (Calendar) now.clone(); end.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH) + 1); end.set(Calendar.HOUR_OF_DAY, Integer.parseInt(endHourMin.split(":")[0])); end.set(Calendar.MINUTE, Integer.parseInt(endHourMin.split(":")[1])); return now.after(start) && now.before(end); }  }
TimeUtil { public static boolean isNowBetweenTimeSpanOfDay(String startHourMin, String endHourMin){ Calendar now = Calendar.getInstance(); Calendar start = (Calendar) now.clone(); start.set(Calendar.HOUR_OF_DAY, Integer.parseInt(startHourMin.split(":")[0])); start.set(Calendar.MINUTE, Integer.parseInt(startHourMin.split(":")[1])); Calendar end = (Calendar) now.clone(); end.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH) + 1); end.set(Calendar.HOUR_OF_DAY, Integer.parseInt(endHourMin.split(":")[0])); end.set(Calendar.MINUTE, Integer.parseInt(endHourMin.split(":")[1])); return now.after(start) && now.before(end); }  static boolean isNowBetweenTimeSpanOfDay(String startHourMin, String endHourMin); static String timestampToStr(long secondTimestamp); static String timestampToStr(long millTimestamp, String format); static long strToTimestamp(String date, String format); static synchronized String getDateNow(String format); }
TimeUtil { public static boolean isNowBetweenTimeSpanOfDay(String startHourMin, String endHourMin){ Calendar now = Calendar.getInstance(); Calendar start = (Calendar) now.clone(); start.set(Calendar.HOUR_OF_DAY, Integer.parseInt(startHourMin.split(":")[0])); start.set(Calendar.MINUTE, Integer.parseInt(startHourMin.split(":")[1])); Calendar end = (Calendar) now.clone(); end.set(Calendar.DAY_OF_MONTH, now.get(Calendar.DAY_OF_MONTH) + 1); end.set(Calendar.HOUR_OF_DAY, Integer.parseInt(endHourMin.split(":")[0])); end.set(Calendar.MINUTE, Integer.parseInt(endHourMin.split(":")[1])); return now.after(start) && now.before(end); }  static boolean isNowBetweenTimeSpanOfDay(String startHourMin, String endHourMin); static String timestampToStr(long secondTimestamp); static String timestampToStr(long millTimestamp, String format); static long strToTimestamp(String date, String format); static synchronized String getDateNow(String format);  }