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

StringconvertDateToBulgarianFormat(Date date)
convert Date To Bulgarian Format
String dateInBulgarianFormat = dateFormatBulgarian.format(date);
return dateInBulgarianFormat;
StringconvertDateToCustomFormat(Date date, String datePattern)
convert Date To Custom Format
SimpleDateFormat dateFormatCustom = new SimpleDateFormat(datePattern);
String dateInCustomFormat = dateFormatCustom.format(date);
return dateInCustomFormat;
StringconvertDateToDateString(Date date)
Converts an instance of java.util.Date into a String using the date format: yyyy-MM-ddZ.
if (date == null) {
    return null;
} else {
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd'Z'");
    df.setTimeZone(TimeZone.getTimeZone("UTC"));
    return df.format(date);
StringconvertDateToFileName(final Date datum)
konvertiere ein Date in ein lesbareres format.
final Calendar calendar = Calendar.getInstance();
calendar.setTime(datum);
final SimpleDateFormat format = new SimpleDateFormat(DATE_FILE_FORMAT_PATTERN);
return format.format(datum);
StringconvertDateToGMTDateString(Date date)
convert Date To GMT Date String
SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z");
TimeZone tz = TimeZone.getTimeZone("GMT");
sdf.setTimeZone(tz);
String dateStr = sdf.format(date);
return dateStr;
StringconvertDateToHour(Date d)
convert Date To Hour
SimpleDateFormat df = new SimpleDateFormat("HH", new DateFormatSymbols());
return df.format(d);
StringconvertDateToISO8601(Date date)
Method that converts a Java date to an ISO 8601 string
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
return dateFormat.format(date);
StringconvertDateToMMDDYYYY(Date date)
Converts a date object into MM/dd/YYYY.
return MMDDYYYYFormat.format(date);
StringconvertDateToRpcFormat(Date date)
convert Date To Rpc Format
if (date == null)
    return "";
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
String mDateFormat = "";
...
StringconvertDateToString(Date aDate)
This method generates a string representation of a date based on the System Property 'dateFormat' in the format you specify on input
return getDateTime(getDatePattern(), aDate);