DateHelper { public static boolean isEmpty(Date date) { if(date == null || date.getTime() == EMPTY_DATE_MS) { return true; } Calendar cal = getEmptyCalendar(); cal.setTime(date); return cal.get(Calendar.YEAR) == 1970 && cal.get(Calendar.MONTH) == Calendar.JANUARY && cal.get(Calendar.DAY_OF_MONTH) == 1 && cal.get(Calendar.HOUR) == 0 && cal.get(Calendar.MINUTE) == 0 && cal.get(Calendar.SECOND) == 0 && cal.get(Calendar.MILLISECOND) == 0; } private  DateHelper(); static String format(Date dt); static String format(Date dt, String pattern); static String formatShortDate(Date dt); static String formatShortTime(Date dt); static String formatISO8601(Date dt); static Calendar getEmptyCalendar(); static Calendar calendar(int year, int month, int day); static Date date(int year, int month, int day); static Date beginOfDay(Date dt); static Date endOfDay(Date dt); static int diffDays(Date dtEnd, Date dtBegin); static Date setTime(Date date, Date time); static Date getTime(Date datetime); static boolean isOnlyTime(Date dt); static boolean isOnlyDate(Date dt); static Date addDays(Date date, int count); static boolean isEmpty(Date date); static String[] getWeekdays(); static String[] getShortWeekdays(); static int[] getIndexWeekdays(); static final String DATE_FORMAT_ISO8601; }
@Test public void testIsEmpty() throws Exception { SimpleDateFormat frm = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); Date date = frm.parse("00.00.0000 00:00:00"); assertTrue(DateHelper.isEmpty(date)); }