Java Utililty Methods Date Format

List of utility methods to do Date Format

Description

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

Method

StringformatDate(final Calendar date)
Returns a date in a readable format.
if (date == null) {
    return null;
final DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
return df.format(date.getTime());
StringformatDate(final Date dat)
Format Date accoring to Patter of 'YYYY-MM-DD' and Locale of US
return formatDate(dat, SHORT_DATE_FORMAT, Locale.US);
StringformatDate(final Date date)
format Date
String dateStr = null;
if (date != null) {
    final DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.ENGLISH);
    dateStr = df.format(date);
return dateStr;
StringformatDate(final Date date)
Formats the given date according to the RFC 1123 pattern.
return formatDate(date, PATTERN_RFC1123);
StringformatDate(final Date date)
Formats a Java Date object into a string of the format yyyy-MM-ddTHH:mm:ssZ.
return DATE_FORMAT.get().format(date);
StringformatDate(final Date date)
format Date
if (null == date) {
    return "";
final SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN);
return formatter.format(date);
StringformatDate(final Date date)
format Date
Preconditions.checkNotNull(date, "Error: Date argument can't be null.");
return DateFormat.getDateInstance().format(date);
StringformatDate(final Date date)
formats a date object to a nice format
final SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd, yyyy");
return formatter.format(date);
StringformatDate(final Date date)
Formats the given date-time using the default pattern: #SDF
final String stringDate = SDF.format(date);
return stringDate;
StringformatDate(final java.util.Date date)
Format date.
return formatDate(date, PATTERN_DEFAULT);