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

java.sql.DateparseUtilDateToSqlDate(Date date)
parse Util Date To Sql Date
return new java.sql.Date(date.getTime());
DatestringToDate(final String dateString)
string To Date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
try {
    date = sdf.parse(dateString);
} catch (ParseException e1) {
    try {
        date = Timestamp.valueOf(dateString);
    } catch (IllegalArgumentException expected) {
...
DatestringToDate(String date)
string To Date
return java.sql.Date.valueOf(date);
DatestringToDate(String date, Class dateType)
string To Date
try {
    Date dat = getSimpleDateFormat().parse(date);
    if (dateType.equals(java.sql.Date.class))
        return new java.sql.Date(dat.getTime());
    else if (dateType.equals(Time.class))
        return new Time(dat.getTime());
    else if (dateType.equals(Timestamp.class))
        return new Timestamp(dat.getTime());
...
java.sql.DatestringToDate(String dateStr)
string To Date
return java.sql.Date.valueOf(dateStr);
java.sql.DatestringToDate(String dta)
string To Date
java.sql.Date data;
int dia = Integer.parseInt(dta.substring(0, 2));
int mes = Integer.parseInt(dta.substring(3, 5));
int ano = Integer.parseInt(dta.substring(6, 10));
data = new java.sql.Date(ano - 1900, mes - 1, dia);
return data;
DatestringToDate(String str)
string To Date
Date date = null;
try {
    date = java.sql.Date.valueOf(str);
} catch (Exception e) {
    e.printStackTrace();
return date;
DatestringToDate(String str)
string To Date
return stringToDate(str, DEFAULT_DATE_PATTERN);
TimestampStringToDateHMS(String str)
String To Date HMS
Timestamp time = null;
time = Timestamp.valueOf(str);
return time;
java.sql.DatestringToSqlDate(String data)
string To Sql Date
if (data == null) {
    return null;
data = data.trim();
if (PADRAO_DATA_YYYYMMDD.matcher(data).matches()) {
    data = data.replace('/', '-');
} else if (PADRAO_DATA_DDMMYYYY.matcher(data).matches()) {
    String dt[] = data.split("[/-]");
...