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 date)
Utility routine to convert a date to a string.
return m_stdDateFormat.format(date).toString();
Stringdate2String(Date date)
date String
String time = null;
try {
    SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm");
    time = format.format(date);
} catch (Exception e) {
    e.printStackTrace();
return time;
...
Stringdate2String(Date date, DateFormat dateFormat)
date String
if (date == null)
    return null;
return dateFormat.format(date);
Stringdate2String(Date date, int _iType)
date String
SimpleDateFormat sdf = new SimpleDateFormat(time_format);
String strTemp = sdf.format(date);
SimpleDateFormat formatter = null;
switch (_iType) {
case 0: 
    strTemp = strTemp.substring(0, 8);
    break;
case 2: 
...
StringDate2String(Date date, String DateFormat)
Date String
SimpleDateFormat sdf = new SimpleDateFormat(DateFormat);
try {
    return sdf.format(date);
} catch (Exception e) {
    e.printStackTrace();
    return null;
Stringdate2string(Date date, String format)
datestring
SimpleDateFormat sdf = new SimpleDateFormat(format);
String result = sdf.format(date);
sdf = null;
return result;
Stringdate2String(Date date, String format)
date String
return getDate2Str(format, date);
Stringdate2String(Date date, String format)
date String
if (date == null)
    return "";
SimpleDateFormat sdformat = new SimpleDateFormat(format);
return sdformat.format(date);
StringDate2String(Date date, String formatPattern)
Date String
return Date2String(date, formatPattern, null, null);
Stringdate2String(Date date, String pattern)
Date --> String
java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat(pattern);
return dateFormat.format(date);