Java Utililty Methods Calendar to String

List of utility methods to do Calendar to String

Description

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

Method

StringtoString(Calendar calendar)
Default calendar to string conversion.
return toString(calendar, DEFAULT_DATE_FORMAT);
StringtoString(final Calendar calendar, final String format)
to String
final SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(calendar.getTime());
StringtoString(GregorianCalendar g1)
to String
StringBuilder buffer = new StringBuilder();
buffer.append(
        g1.get(Calendar.YEAR) + "/" + (g1.get(Calendar.MONTH) + 1) + "/" + g1.get(Calendar.DAY_OF_MONTH));
buffer.append("  ");
buffer.append(g1.get(Calendar.HOUR_OF_DAY) + ":" + g1.get(Calendar.MINUTE) + ":" + g1.get(Calendar.SECOND)
        + "." + g1.get(Calendar.MILLISECOND));
return buffer.toString();