List of utility methods to do Date Compare by Year
boolean | sameYear(Date date1, Date date2) Checks if the two given date have the same year. if (date1 == null || date2 == null) { return false; return getYear(date1) == getYear(date2); |
boolean | sameYear(Date date1, Date date2) same Year if (date1 == null || date2 == null) { return false; Calendar calendar = Calendar.getInstance(); calendar.setTime(date1); Calendar calendar2 = Calendar.getInstance(); calendar.setTime(date2); return calendar.get(Calendar.YEAR) - calendar.get(Calendar.YEAR) == 0; ... |