Java Utililty Methods SQL Date Compare

List of utility methods to do SQL Date Compare

Description

The list of methods to do SQL Date Compare are organized into topic(s).

Method

booleancompareDate(java.sql.Date date1, java.sql.Date date2)
compare Date
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmm");
String str1 = formatter.format(date1);
String str2 = formatter.format(date2);
if (str1.equals(str2))
    return true;
else
    return false;
longcompareDate(java.util.Date s1, java.util.Date s2)
compare Date
try {
    return compareDate(DEFAULT_DATE_YMD_FORMAT, toString(s1), toString(s2));
} catch (Exception e) {
    return -1;
intcompareDates(Date date1, Date date2)
Equivalent of compareTo() but actually works because Sun fucked up the JDK.
if (date1 instanceof Timestamp) {
    if (date2 instanceof Timestamp) {
        return date1.compareTo(date2);
    } else {
        return date1.compareTo(new Timestamp(date2.getTime()));
} else {
    if (date2 instanceof Timestamp) {
...
intcompareSqlDate(Object left, Object right)
compare Sql Date
java.sql.Date l = (java.sql.Date) left;
java.sql.Date r = (java.sql.Date) right;
return l.compareTo(r);