Java Utililty Methods Calendar Format

List of utility methods to do Calendar Format

Description

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

Method

Stringformat(Calendar calendar)
Extrats date from the specified calendar and formats it using default date format.
return dateFormat.format(calendar.getTime());
Stringformat(Calendar calendar, String format)
format
if (format.contains(TWY)) {
    String twy = String.valueOf(calendar.get(Calendar.YEAR) - 1911);
    while (twy.length() < 3) {
        twy = "0" + twy;
    format = format.replace(TWY, twy);
} else if (format.contains(TW)) {
    String twy = String.valueOf(calendar.get(Calendar.YEAR) - 1911);
...
Stringformat(Calendar calendar, String format)
format
return format(calendar.getTimeInMillis(), format);
Stringformat(Calendar calendar, String formatString)
format
if (calendar == null)
    return "";
SimpleDateFormat frmt = new SimpleDateFormat(formatString);
Date date = calendar.getTime();
return frmt.format(date);
Stringformat(Calendar calendar, String pattern)
Formats the given Calendar while considering the time zone information.
return format(calendar, new SimpleDateFormat(pattern));
Stringformat(Calendar current)
Format the date.
return format(current.getTime());
Stringformat(Calendar self, String pattern)

Shortcut for java.text.SimpleDateFormat to output a String representation of this calendar instance.

SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setTimeZone(self.getTimeZone());
return sdf.format(self.getTime());
Stringformat(final Calendar cal)
Formats a Calendar value into an ISO8601-compliant date/time string.
if (cal == null) {
    throw new IllegalArgumentException("argument can not be null");
int year = cal.get(Calendar.YEAR);
if (cal.isSet(Calendar.ERA) && cal.get(Calendar.ERA) == GregorianCalendar.BC) {
    year = 0 - year + 1;
StringBuilder buf = new StringBuilder();
...
StringformatarData(Calendar data)
formatar Data
return dataSimples.format(new Date(data.getTimeInMillis()));
StringformatCalendar(Calendar calendar)
format Calendar
return formatCalendar(calendar, DEFAULTFORMAT);