This method of the DateDataFormat class sets the custom format string.
public void setCustomFormat(String value);
value | The string to be used to format dates or times. |
The setting of the customFormat property is only applied when the format property is set to DateFormat.CUSTOM. If the format property is not set to DateFormat.CUSTOM, the custom format string is ignored.
Use the following guidelines to specify the custom format string:
To display months, days, hours, minutes, or seconds as numbers with no leading zeros, use m, d, h, m, or s, respectively.
To display months, days, hours, minutes, or seconds as numbers with leading zeros before single digits, use mm, dd, hh, mm, or ss, respectively.
To display abbreviations for the month, day, or year, use mmm, ddd, or yy, respectively.
To display the full name of the month, day, or year, use mmmm, dddd, or yyyy, respectively.
To display time according to the 12-hour clock, use AM/PM, am/pm, A/P, or a/p. (To display the default AM/PM symbol that is defined by your system settings, use AMPM.)
To display static text within the format string, enclose the text in single quotation marks ('). Date and time symbols, such as the slash (/) and colon (:), do not require quotation marks. For example:
'The date is' m/d/yy.
See Also getCustomFormat