Android 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(Context context, Calendar date, FileTimeDisplay fileTimeDisplay)
Formats date.
final Calendar _yesterday = Calendar.getInstance();
_yesterday.add(Calendar.DAY_OF_YEAR, -1);
String res;
if (android.text.format.DateUtils.isToday(date.getTimeInMillis())) {
    res = android.text.format.DateUtils.formatDateTime(context,
            date.getTimeInMillis(), _FormatShortTime);
else if (date.get(Calendar.YEAR) == _yesterday.get(Calendar.YEAR)
...
StringformatDate(Context context, long millis, FileTimeDisplay fileTimeDisplay)
Formats date.
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(millis);
return formatDate(context, cal, fileTimeDisplay);
StringformatDate(Date d)
format Date
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return s.format(d);
StringformatDate(Date date)
format Date
return formatDate(date, DEFAULTFORMAT);
StringformatDate(Date date)
Format date with default `DATE_FORMAT` and default locale `Locale.KOREA`
return formatDate(date, DATE_FORMAT);
StringformatDate(Date date)
Formats the given date according to the RFC 1123 pattern.
return formatDate(date, PATTERN_RFC1123);
StringformatDate(Date date)
Formats the given date according to the RFC 1123 pattern.
return formatDate(date, PATTERN_RFC1123);
StringformatDate(Date date, String dateFormat)
Format date with `dateFormat` given and default locale `Locale.KOREA`
return formatDate(date, dateFormat, Locale.ENGLISH);
StringformatDate(Date date, String dateFormat, Locale locale)
Format date
SimpleDateFormat format = new SimpleDateFormat(dateFormat, locale);
return format.format(date);
StringformatDate(Date date, String pattern)
format Date
if (date == null)
    return "";
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return formatCalendar(calendar, pattern);