PluginDateUtils { public static boolean sameDay(long instant1, long instant2, String tzName) { DateTimeZone zone = null; try { zone = DateTimeZone.forID(tzName); } catch (IllegalArgumentException e) { zone = DateTimeZone.getDefault(); } DateTime date1 = new DateTime(instant1, zone); DateTime date2 = new DateTime(instant2, zone); return (date1.year().get() == date2.year().get()) && (date1.monthOfYear().get() == date2.monthOfYear().get()) && (date1.dayOfMonth().get() == date2.dayOfMonth().get()); } private  PluginDateUtils(); static void humanizeDate(long instantMs, long now, boolean showSeconds, StringBuilder buf); static void humanizeDate(long instantMs, long baseMs, String tzId, boolean showSeconds, StringBuilder buf); static boolean sameDay(long instant1, long instant2, String tzName); static void formatDate(Locale locale, String fmt, long instant, String tzName, StringBuilder buf); static String getTimeZoneNameFromContext(Context ctx);  }
@Test public void testSameDay() { long baseMs = MAY_13_2013_010000_UTC; assertTrue(sameDay(baseMs, baseMs + (ONE_MINUTE_MS * 5), TZ_UTC)); assertFalse(sameDay(baseMs, baseMs + (ONE_DAY_MS * 2), TZ_UTC)); assertFalse(sameDay(baseMs, baseMs + (ONE_MONTH_MS * 2), TZ_UTC)); assertFalse(sameDay(baseMs, baseMs + (ONE_YEAR_MS * 2), TZ_UTC)); }