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(Date date)
Synchronized format of date to string using #DATE_FORMAT
synchronized (DATE_FORMAT) {
    return DATE_FORMAT.format(date);
StringformatDate(Date date)
Converte de Data para String
return sdf.format(date);
StringformatDate(Date date)
format Date
if (date == null) {
    return "never";
GregorianCalendar today = new GregorianCalendar();
today.setTime(new Date());
today.set(Calendar.HOUR_OF_DAY, 0);
today.set(Calendar.MINUTE, 0);
today.set(Calendar.SECOND, 1);
...
StringformatDate(Date date)
Formats the given date according to the RFC 1123 pattern.
return formatDate(date, PATTERN_RFC1123);
StringformatDate(Date date)
Returns a String from a Date object
String formatString = new String();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
if (cal.isSet(Calendar.MINUTE))
    formatString = "yyyyMMdd'T'hhmmss";
else
    formatString = "yyyyMMdd";
SimpleDateFormat formatter = new SimpleDateFormat(formatString);
...
StringformatDate(Date date)
Format the date into "yyyy-MM-dd" format.
return formatDate(date, FMT_DATE_YYYY_MM_DD);
StringformatDate(Date date)
Format date.
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
return sd.format(date);
StringformatDate(Date date)
Formats the time to the Docker-standard format.
TimeZone tz = TimeZone.getTimeZone("UTC");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
df.setTimeZone(tz);
return df.format(date) + "000000Z";
StringformatDate(Date date)
Formats a date.
if (date == null) {
    return null;
return DateFormat.getDateTimeInstance().format(date);
StringformatDate(Date date)
format Date
try {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    return sdf.format(date);
} catch (RuntimeException e) {
    return "";