format
public static String format(Date date,
Locale locale,
Format.FORMAT_TYPE type)
This method formats a date object according to a particular locale and returns the date as a string.
The string can contain only the date (month, day and year), only the time (hours, minutes, seconds) or as a
timestamp (both date and time).
- Parameters:
date
- input date to format as a string
locale
- input locale to determine how to format the date
type
- input type to determine how much information from the date is returned
- Returns:
- empty string if one of the parameters is null. Otherwise a string object for the date such that it is
formatted according to locale and the amount of information it contains is determined by type.
Should not fail when only date is null
Should not fail when only locale is null
Should not fail when only type is null
Should not fail when date and locale is null
Should not fail when date and type is null
Should not fail when locale and type is null
Should not fail when all parameters are null
Should not fail when none of the parameters are null