Java Utililty Methods Date to String

List of utility methods to do Date to String

Description

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

Method

Stringdate2String(Date source, String formatString)
date String
return date2String(source, new SimpleDateFormat(formatString));
Stringdate2String(Date value)
date String
if (value != null) {
    SimpleDateFormat date = new SimpleDateFormat("yyyy/MM/dd");
    return date.format(value);
return "";
Stringdate2String(java.util.Date date, String format)
date String
if (date == null) {
    return null;
if (format == null || "".equals(format)) {
    format = defaultFormat;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
String dateOfStr = "";
...
Stringdate2String(java.util.Date date, String pattern)
date String
if (date == null) {
    throw new java.lang.IllegalArgumentException("timestamp null illegal");
if (pattern == null || pattern.equals("")) {
    pattern = PATTERN_STANDARD;
    ;
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
...
Stringdate2String(String formater, Date aDate)
date String
if (formater == null || "".equals(formater))
    return null;
if (aDate == null)
    return null;
return new SimpleDateFormat(formater).format(aDate);
Stringdate2String(String pattern, Date date)
date String
String retStr = "";
java.text.SimpleDateFormat ff = new java.text.SimpleDateFormat();
ff.applyPattern(pattern);
retStr = ff.format(date);
return retStr;
Stringdate2String2(Date date)
date String
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat7);
String dateString = formatter.format(date);
return dateString;
Stringdate2StringISO(Date date)
Erzeugt einen String im Format YYYY-MM-DD
return new SimpleDateFormat("yyyy-MM-dd").format(date);
Stringdate2StringMD(Date date)
date String MD
DateFormat format1 = new SimpleDateFormat("MMdd");
return format1.format(date);
Stringdate2StringPattern(Date value, String pattern)
date String Pattern
if (value != null) {
    SimpleDateFormat dateTimeNoSlash = new SimpleDateFormat(pattern);
    return dateTimeNoSlash.format(value);
return "";