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

StringformatDashedDateDDMMYYYY(Date date)
Formats the specified date as dd-MM-yyyy.
SimpleDateFormat f = new SimpleDateFormat(DATE_FORMAT_DASHED_DD_MM_YYYY);
f.setTimeZone(TimeZone.getDefault());
return f.format(date);
StringformatDate(ArrayList list)
format Date
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, (int) list.get(0));
cal.set(Calendar.MONTH, (int) list.get(1) - 1);
cal.set(Calendar.DAY_OF_MONTH, (int) list.get(2));
Date date = cal.getTime();
DateFormat requiredFormat = new SimpleDateFormat("dd MMMM YYYY");
return requiredFormat.format(date);
StringformatDate(Date _date)
format Date
if (_date == null) {
    return "1970-01-01";
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(_date);
StringformatDate(Date aDate)
format Date
return dfA.format(aDate);
StringformatDate(Date d)
format Date
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Calendar c = Calendar.getInstance();
c.setTime(d);
return df.format(c.getTime());
StringformatDate(Date d)
format Date
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
return df.format(d);
StringformatDate(Date d)
format Date
if (s_df == null)
    s_df = new SimpleDateFormat("dd MMM yyyy HH:mm:ss zzz");
return s_df.format(d);
StringformatDate(Date d)
format Date
Calendar c = Calendar.getInstance();
c.setTimeInMillis(d.getTime());
return formatNumber("00", c.get(Calendar.MONTH) + 1) + "/"
        + formatNumber("00", c.get(Calendar.DAY_OF_MONTH)) + "/"
        + formatNumber("00", c.get(Calendar.YEAR) % 100);
StringformatDate(Date d)
format Date
return format(d, DATE_FORMAT);
StringformatDate(Date d)
format Date
return DATE_FORMAT.format(d);