Java Utililty Methods SQL Date Check

List of utility methods to do SQL Date Check

Description

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

Method

booleanisChunjie(String date)
is Chunjie
if (initChunJie().containsKey(date)) {
    return true;
return false;
booleanisDataTypeDate(int dataType)
Returns true if dataType is a valid date data type
return dataType == Types.DATE || dataType == Types.TIMESTAMP || dataType == Types.TIME;
booleanisDate(final PropertyDescriptor pd)
is Date
return pd.getPropertyType().isAssignableFrom(java.sql.Date.class);
booleanisDate(int colType)
Checks whether the given column type represents a date-like type.
return (colType == Types.DATE) || (colType == Types.TIME) || (colType == Types.TIMESTAMP);
booleanisDate(int dataType)
is Date
switch (dataType) {
case java.sql.Types.DATE:
case java.sql.Types.TIME:
case java.sql.Types.TIMESTAMP:
    return true;
default:
    return false;
booleanisDate(int dataType)
is Date
List<Integer> validTypes = Arrays.asList(Types.DATE, Types.TIME, Types.TIMESTAMP);
return validTypes.contains(dataType);
booleanisDate(Object obj)
is Date
if (obj == null)
    return false;
return obj instanceof java.sql.Date || obj instanceof java.util.Date;
booleanisDate(String str)
is Date
if (!Strings.isNullOrEmpty(str) && str.matches(DATE)) {
    Calendar cal1 = Calendar.getInstance();
    Calendar cal2 = Calendar.getInstance();
    cal1.setTime(java.sql.Date.valueOf(str));
    cal2.setTimeInMillis(new java.util.Date().getTime());
    return Math.abs(cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR)) <= 50;
return false;
...
booleanisDate(String val)
is Date
try {
    Date.valueOf(val);
    return true;
} catch (IllegalArgumentException ie) {
return false;
booleanisDateOneAfterDateTwo(Date dateOne, Date dateTwo)
is Date One After Date Two
boolean valid = false;
if (dateOne != null && dateTwo != null && dateOne.after(dateTwo)) {
    valid = true;
return valid;