Java Utililty Methods SQL Date From

List of utility methods to do SQL Date From

Description

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

Method

java.sql.DatetoSqlDate(String dateStr, String format)
to Sql Date
DateFormat dateFormat = new SimpleDateFormat(format);
dateFormat.setLenient(false);
Date date = dateFormat.parse(dateStr);
return new java.sql.Date(date.getTime());
java.sql.DatetoSQLDate(String dt)
convert date String (yyyyMMdd or yyyyMMddHHmmss) to java.sql.Date
return new java.sql.Date(toUtilDate(dt).getTime());
java.sql.DatetoSQLDate(String sDate, String format)
to SQL Date
java.sql.Date sqlDate = null;
Date utilDate = null;
if (sDate != null) {
    utilDate = toUtilDate(sDate, format);
    sqlDate = toSQLDate(utilDate);
return sqlDate;
java.sql.DatetoSqlDateFromStrDate(String p_strDate)
to Sql Date From Str Date
java.sql.Date returnDate = null;
java.text.DateFormat sdf = new java.text.SimpleDateFormat();
if (p_strDate != null && (!"".equals(p_strDate))) {
    returnDate = new java.sql.Date(sdf.parse(p_strDate).getTime());
return returnDate;
java.sql.DatetoSqlDateJdbcEscape(final String str)
to Sql Date Jdbc Escape
try {
    return java.sql.Date.valueOf(str);
} catch (final IllegalArgumentException ex) {
    return null;
StringtoSqlDateString(java.sql.Date d, String pattern)
to Sql Date String
String rs = "";
try {
    SimpleDateFormat formatter = new SimpleDateFormat(pattern);
    rs = formatter.format(d);
} catch (Exception e) {
    e.printStackTrace();
return isFirstStartDate(rs) ? "" : rs;
...