DateUtils { public static long numberOfDaysSinceEpoch(long milliSinceEpoch) { return TimeUnit.MILLISECONDS.toDays(milliSinceEpoch); }  static Date parseISO8601Date(String dateString); static String formatISO8601Date(Date date); static String formatISO8601Date(DateTime date); static Date parseRFC822Date(String dateString); static String formatRFC822Date(Date date); static Date parseCompressedISO8601Date(String dateString); static Date parseServiceSpecificDate(String dateString); static Date parseUnixTimestampInMillis(String dateString); static String formatServiceSpecificDate(Date date); static String formatUnixTimestampInMills(Date date); static Date cloneDate(Date date); static long numberOfDaysSinceEpoch(long milliSinceEpoch);  }
@Test public void numberOfDaysSinceEpoch() { final long now = System.currentTimeMillis(); final long days = DateUtils.numberOfDaysSinceEpoch(now); final int oneDayMilli = 24*60*60*1000; assertTrue(now > days*oneDayMilli); assertTrue((now - days*oneDayMilli) <= oneDayMilli); }