Java Utililty Methods SQL Date Convert

List of utility methods to do SQL Date Convert

Description

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

Method

java.util.DatetoJavaDate(java.sql.Date date)
to Java Date
if (date == null) {
    return null;
return new java.util.Date(date.getTime());
DatetoJavaDate(java.sql.Date sqlDate)
to Java Date
return sqlDate == null ? null : new Date(sqlDate.getTime());
longtoLong(java.util.Date v)
to Long
return toLong(v, LOCAL_TZ);
StringtoName(Date date)
to Name
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
return sf.format(date);
inttotalUpdateCount(int[] result)
Summarize the returned array of java.sql.Statement#executeBatch()
int total = 0;
for (int i : result) {
    if (i >= 0) {
        total += i;
return total;
StringtoYMD(Date date, String datePtn)
to YMD
if (date == null) {
    return null;
return toString(date, getYMDFormat(datePtn));