@Test public void testIsBetween() { Assert.assertTrue(DateUtil.isBetween(DateUtil.getDayBegin(), DateUtil.getDayEnd())); Assert.assertFalse(DateUtil.isBetween( DateUtil.getDayBegin(new Date(0L)), DateUtil.getDayEnd(new Date(100_000L)))); }
public static boolean isBetween(Date beginTime, Date endTime) { Assert.notNull(beginTime, "开始时间不能为空"); Assert.notNull(endTime, "结束时间不能为空"); Date now = new Date(); return beginTime.getTime() <= now.getTime() && now.getTime() <= endTime.getTime(); }
DateUtil { public static boolean isBetween(Date beginTime, Date endTime) { Assert.notNull(beginTime, "开始时间不能为空"); Assert.notNull(endTime, "结束时间不能为空"); Date now = new Date(); return beginTime.getTime() <= now.getTime() && now.getTime() <= endTime.getTime(); } }
DateUtil { public static boolean isBetween(Date beginTime, Date endTime) { Assert.notNull(beginTime, "开始时间不能为空"); Assert.notNull(endTime, "结束时间不能为空"); Date now = new Date(); return beginTime.getTime() <= now.getTime() && now.getTime() <= endTime.getTime(); }  }
DateUtil { public static boolean isBetween(Date beginTime, Date endTime) { Assert.notNull(beginTime, "开始时间不能为空"); Assert.notNull(endTime, "结束时间不能为空"); Date now = new Date(); return beginTime.getTime() <= now.getTime() && now.getTime() <= endTime.getTime(); }  static Date addDate(int field, int amount); static Date addDate(Date date, int field, int amount); static String format(Date date, String pattern); static Date getDayBegin(Date date); static Date getDayBegin(); static Date getDayEnd(Date date); static Date getDayEnd(); static void setCalender(Calendar calendar, int hour, int minute, int second, int milliSecond); static boolean isBetween(Date beginTime, Date endTime); static Date max(Date a, Date b); }
DateUtil { public static boolean isBetween(Date beginTime, Date endTime) { Assert.notNull(beginTime, "开始时间不能为空"); Assert.notNull(endTime, "结束时间不能为空"); Date now = new Date(); return beginTime.getTime() <= now.getTime() && now.getTime() <= endTime.getTime(); }  static Date addDate(int field, int amount); static Date addDate(Date date, int field, int amount); static String format(Date date, String pattern); static Date getDayBegin(Date date); static Date getDayBegin(); static Date getDayEnd(Date date); static Date getDayEnd(); static void setCalender(Calendar calendar, int hour, int minute, int second, int milliSecond); static boolean isBetween(Date beginTime, Date endTime); static Date max(Date a, Date b);  }