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

StringdateToString(Date d)
date To String
if (d == null)
    return null;
return df_yyyyMMdd.format(d);
StringdateToString(Date d)
date To String
c1.setTime(d);
Date date = c1.getTime();
String strDate = "";
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
strDate = sdf.format(date);
return strDate;
StringdateToString(Date data, String format)
date To String
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
StringBuilder dateString = new StringBuilder(dateFormat.format(data));
return dateString.toString();
StringdateToString(Date date)
date To String
if (date != null) {
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_PATTERN);
    simpleDateFormat.setTimeZone(UTC);
    return simpleDateFormat.format(date);
return "";
StringdateToString(Date date)
Parse a Date object into a String.
if (date == null) {
    return null;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSS");
format.setTimeZone(TimeZone.getTimeZone("GMT-0"));
return format.format(date) + "Z";
StringdateToString(Date date)
date To String
SimpleDateFormat format = new SimpleDateFormat(ISO_FORMAT);
format.setTimeZone(UTC);
return format.format(date);
StringdateToString(Date date)
date To String
return getSimpleDateFormat().format(date);
StringDateToString(Date date)
Covernt a date object to a string in the format yyyy-MM-dd HH:mm:ss
return dateFormat.format(date);
StringdateToString(Date date)
date To String
return getFormat().format(date);
StringdateToString(Date date)
date To String
DateFormat df = new SimpleDateFormat(DATE_FORMAT);
if (date != null) {
    return df.format(date);
} else {
    return null;