public static String formatDate(final Date date, final int type, final Locale locale) {
    Preconditions.checkNotNull(date, "Error: Date argument can't be null.");
    Preconditions.checkNotNull(locale, "Error: Locale argument can't be null.");

    final String s =
        String.format(
            "%s %s",
            DateFormat.getDateInstance(type, locale).format(date),
            DateFormat.getTimeInstance(type, locale).format(date));

    return s;
  }
Formats a date string regarding the given locale.

@param date The date to format.
@param type Defines the display type of month
@param locale The given locale.
@return The data string.
java/zylib/src/main/java/com/google/security/zynamics/zylib/date/DateHelpers.java