Android Utililty Methods SQL Date Format

List of utility methods to do SQL Date Format

Description

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

Method

StringformatDate(java.sql.Date value)
format Date
return formatDate(value, ISO_DATE_FORMAT);
StringformatDate(java.sql.Date value, String defaultFormat)
format Date
if (value == null) {
    return "";
String strFormatStyle = StringUtils.isEmpty(defaultFormat) ? ISO_DATE_FORMAT
        : defaultFormat;
SimpleDateFormat objSimpleDateFormat = new SimpleDateFormat(
        strFormatStyle);
return objSimpleDateFormat.format(value);
...
StringformatDate(java.util.Date value)
format Date
return formatDate(value, ISO_DATE_FORMAT);
StringformatDate(java.util.Date value, String defaultFormat)
format Date
if (value == null) {
    return "";
String strFormatStyle = StringUtils.isEmpty(defaultFormat) ? ISO_DATE_FORMAT
        : defaultFormat;
SimpleDateFormat objSimpleDateFormat = new SimpleDateFormat(
        strFormatStyle);
return objSimpleDateFormat.format(value);
...
StringDateToStringSQL(Date date, String separador)
Date To String SQL
if (date == null) {
    return null;
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int dia = calendar.get(Calendar.DAY_OF_MONTH);
String stringDia = dia < 10 ? "0" + dia : String.valueOf(dia);
int mes = calendar.get(Calendar.MONTH) + 1;
...
StringDateToString(Date date, String separador)
Date To String
if (date == null) {
    return null;
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int dia = calendar.get(Calendar.DAY_OF_MONTH);
String stringDia = dia < 10 ? "0" + dia : String.valueOf(dia);
int mes = calendar.get(Calendar.MONTH) + 1;
...
StringDateToString(Date date)
Date To String
return DateToString(date, "-");
Stringdate2String(java.sql.Date date)
date String
if (date == null)
    return "";
return (date.getYear() + 1900) + "-" + (date.getMonth() + 1) + "-"
        + date.getDate();