@Test public void testNullableDates() { Date d1 = new Date(); Date d2 = new Date(d1.getTime()+14675467); Assert.assertTrue(DateUtil.compareNullableDates(d1, d1)); Assert.assertTrue(DateUtil.compareNullableDates(d2, d2)); Assert.assertTrue(DateUtil.compareNullableDates(null, null)); Assert.assertFalse(DateUtil.compareNullableDates(d1, d2)); Assert.assertFalse(DateUtil.compareNullableDates(null, d2)); Assert.assertFalse(DateUtil.compareNullableDates(d1, null)); }
public static boolean compareNullableDates(Date date1, Date date2) { if ((date1==null) && (date2==null)) return true; if (date1!=null) { if (date1.equals(date2)) return true; else return false; } return false; }
DateUtil { public static boolean compareNullableDates(Date date1, Date date2) { if ((date1==null) && (date2==null)) return true; if (date1!=null) { if (date1.equals(date2)) return true; else return false; } return false; } }
DateUtil { public static boolean compareNullableDates(Date date1, Date date2) { if ((date1==null) && (date2==null)) return true; if (date1!=null) { if (date1.equals(date2)) return true; else return false; } return false; } private  DateUtil(); }
DateUtil { public static boolean compareNullableDates(Date date1, Date date2) { if ((date1==null) && (date2==null)) return true; if (date1!=null) { if (date1.equals(date2)) return true; else return false; } return false; } private  DateUtil(); static String dateToString(Date obj, String format); static Date stringToDate(String strDate, String format); static Date convertFlexibleDate(String strDate, String[] formats); static String convertShortDate(Date obj); static Date convertShortDate(String str); static Date convertShortDate(String str, Date defaultDate); static Date convertFlexibleDate(String strDate); static boolean compareNullableDates(Date date1, Date date2); static boolean hasTime(Date date); static Date getClientCurrentDate(final Calendar calendar, final TimeZone timeZone); static Date getDateFrom(int count, Date date); static Date getDayOfTheWeek(int day, int week, int year); static Date removeTime(Date date); }
DateUtil { public static boolean compareNullableDates(Date date1, Date date2) { if ((date1==null) && (date2==null)) return true; if (date1!=null) { if (date1.equals(date2)) return true; else return false; } return false; } private  DateUtil(); static String dateToString(Date obj, String format); static Date stringToDate(String strDate, String format); static Date convertFlexibleDate(String strDate, String[] formats); static String convertShortDate(Date obj); static Date convertShortDate(String str); static Date convertShortDate(String str, Date defaultDate); static Date convertFlexibleDate(String strDate); static boolean compareNullableDates(Date date1, Date date2); static boolean hasTime(Date date); static Date getClientCurrentDate(final Calendar calendar, final TimeZone timeZone); static Date getDateFrom(int count, Date date); static Date getDayOfTheWeek(int day, int week, int year); static Date removeTime(Date date);  }