Java Utililty Methods Date Format

List of utility methods to do Date Format

Description

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

Method

StringformatDate(Date d)
format Date
return serviceDateToString(d);
StringformatDate(Date d)
format Date
return formatDateTime(d, DATE_PATTERN);
StringformatDate(Date d)
format Date
if (d.getHours() > 0 || d.getMinutes() > 0)
    return formatDate(d, DATE_WITH_DATETIME);
return formatDate(d, DATE_PATTERN);
StringformatDate(Date d)
format Date
return format(d, DATE_PATTERN_DEFAULT);
StringformatDate(Date d)
Convert date to String like "yyyy-MM-dd".
return new SimpleDateFormat(DATE_FORMAT).format(d);
StringformatDate(Date d)
Convert date to string
if (d != null) {
    SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
    return f.format(d);
} else
    return null;
StringformatDate(Date d, int type)
ACME date formatter
DateFormat format = null;
switch (type) {
case FORMAT_DD_MM_YYYY_HH_MM_SS:
    format = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
    break;
case FORMAT_YYYY_MM_DD_HH_MM_SS:
    format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    break;
...
StringformatDate(Date date)
format Date
checkDateFormat();
return dateFormat.format(date);
StringformatDate(Date date)
format Date
return formatDateByFormat(date, "yyyy-MM-dd");
StringformatDate(Date date)
returns the date in String MMddyyyy format.
SimpleDateFormat sdf = null;
if (date != null) {
    sdf = new SimpleDateFormat("MMddyyyy");
    return sdf.format(date);
} else
    return emptyField;