Java Utililty Methods SQL Date Parse

List of utility methods to do SQL Date Parse

Description

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

Method

StringparseDateYYMMddHHmm(java.util.Date date)
parse Date YYM Mdd H Hmm
return new SimpleDateFormat(DATE_FORMAT_yyMMddHHmm).format(date);
StringparseDateYYMMddHHmmss1(Date date)
Parse a java.sql.Date to String
return new SimpleDateFormat(DATE_FORMAT_yyMMddHHmmss).format(date);
DateparseDateyyyy_MM_DD(String ds)
parse DateyyyMDD
return new Date(new SimpleDateFormat(DATE_FORMAT_yyyy_MM_dd).parse(ds).getTime());
java.sql.DateparseSqlDate(final String value)
parse Sql Date
try {
    return new java.sql.Date(getSqlDateFormat().parse(value).getTime());
} catch (ParseException e) {
    return throwRuntimeParseException(value, e);
java.sql.DateparseSqlDate(final String value)
parse Sql Date
try {
    return java.sql.Date.valueOf(value);
} catch (IllegalArgumentException e) {
    return throwRuntimeParseException(value, new ParseException(value, 0), SQL_DATE_FORMAT);
java.sql.DateparseSqlDate(java.util.Date date)
parse Sql Date
if (date == null)
    return null;
return new java.sql.Date(date.getTime());
java.sql.DateparseSqlDate(java.util.Date date)
parse Sql Date
if (date != null) {
    return new java.sql.Date(date.getTime());
} else {
    return null;
java.sql.DateparseSQLDate(String dateStr, String pattern)
parse SQL Date
Date d = parse(dateStr, pattern);
return new java.sql.Date(d.getTime());
java.sql.DateparseString2Date(String s, SimpleDateFormat format)
parse String Date
java.sql.Date date = null;
try {
    date = new java.sql.Date(format.parse(s).getTime());
} catch (ParseException e) {
return date;
java.sql.TimestampparseUTCDateFromString(String dt)
Translates a string of the form yyyyMMddHHmmss (UTC) into asql Date, and returns that date.
if (dt == null)
    return null;
SimpleDateFormat utcDateFormat = (dt.length() > 8) ? new SimpleDateFormat("yyyyMMddHHmmss")
        : new SimpleDateFormat("yyyyMMdd");
java.util.Date pdate = utcDateFormat.parse(dt);
return new java.sql.Timestamp(pdate.getTime());