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

StringtoString(Date value, String format)
to String
if (value != null) {
    SimpleDateFormat dateFormat = new SimpleDateFormat(format);
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    return dateFormat.format(value);
} else {
    return "";
StringtoStringFR(Date date)
to String FR as format "dd/MM/yyyy"
return toString(date, DATE_FORMAT_dd_MM_yyyy);
StringtoStringUS(Date date)
to String US as format "MM/dd/yyyy"
return toString(date, DATE_FORMAT_MM_dd_yyyy);
StringtoTimeString(Date value)
to Time String
if (value != null) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    return dateFormat.format(value);
} else {
    return "";
Stringformat(Date date)
Converts a java.util.Date object to a string using the defined default format yyyy-MM-dd HH:mm
return DEFAULT_FORMATTER.format(date);
Stringformat(Date date, String pattern)
format
if (date == null) {
    return null;
return getFormat(pattern).format(date);
StringformatData(Date date)
format Data
return DATE_FORMAT.format(date);
StringformatDate(final Date date)
format Date
return DateFormat.format(dateFormatString, date).toString();
StringgetStringFromDate(Date date, String format)
get String From Date
SimpleDateFormat formatter = new SimpleDateFormat(format);
return formatter.format(date);
StringgetFormatTomorrow(String format)
get Format Tomorrow
return getFormatCurrentAdd(1, format);