Java Utililty Methods Date Format As

List of utility methods to do Date Format As

Description

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

Method

StringformatDateYMD(Object date)
format Date YMD
return formatDate(date, "yyyy-MM-dd");
StringformatDateYyyymmddhhmmss(Date date)
format Date Yyyymmddhhmmss
return new SimpleDateFormat("yyyyMMddHHmmss").format(date);
StringformatDatum(Date date, Locale locale)
Ein Datum localeabhaengig formatieren.
if (date != null) {
    return DateFormat.getDateInstance(DateFormat.MEDIUM, locale).format(date);
} else {
    return "";
StringformatDay(Date date)
format Day
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(date);
StringformatDay(java.util.Date d)
format Day
return yyyyMMdd.format(d);
StringformatDDMMYYYY(Date date)
Datum formatieren analog zu "31122007).
final String result = ddMMyyyy_DATE_FORMAT.format(date);
return result;
StringformatddMMyyyy(Date date)
formatdd M Myyyy
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
return format.format(date);
StringgetDateAsISO8601String(Date date)
get Date As ISO String
SimpleDateFormat ISO8601FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String result = ISO8601FORMAT.format(date);
result = result.substring(0, result.length() - 2) + ":" + result.substring(result.length() - 2);
return result;
StringgetDateAsISO8601String(Date date)
Format a Date using the standard ISO8601 used in XML.
SimpleDateFormat format_ISO8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US);
return format_ISO8601.format(date);
StringgetDateAsISOTimestampString(Date timestamp)
get Date As ISO Timestamp String
return TIMESTAMP_FORMAT.format(timestamp);