DateFormat.format
Class Overview | Class Members |
This Package |
All Packages
public final StringBuffer format( Object obj,
StringBuffer toAppendTo,
FieldPosition fieldPosition )
Parameters
- obj
- must be a Number or a Date.
- toAppendTo
- the string buffer for the returning time string.
- status
- the formatting status. On input: an alignment field,
if desired. On output: the offsets of the alignment field.
Returns
the formatted time string.
Description
Overrides Format.
Formats a time object into a time string. Examples of time objects
are a time value expressed in milliseconds and a Date object.
Overrides
format in class Format
See Also
Format
public abstract StringBuffer format( Date date,
StringBuffer toAppendTo,
FieldPosition fieldPosition )
Parameters
- date
- a Date to be formatted into a date/time string.
- toAppendTo
- the string buffer for the returning date/time string.
- status
- the formatting status. On input: an alignment field,
if desired. On output: the offsets of the alignment field. For
example, given a time text "1996.07.10 AD at 15:08:56 PDT",
if the given status.field is DateFormat.YEAR_FIELD, the offsets
status.beginIndex and status.getEndIndex will be set to 0 and 4,
respectively. Notice that if the same time field appears
more than once in a pattern, the status will be set for the first
occurence of that time field. For instance, formatting a Date to
the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
"h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
the offsets status.beginIndex and status.getEndIndex will be set to
5 and 8, respectively, for the first occurence of the timezone
pattern character 'z'.
Returns
the formatted date/time string.
Description
Formats a Date into a date/time string.
public final String format( Date date )
Parameters
- date
- the time value to be formatted into a time string.
Returns
the formatted time string.
Description
Formats a Date into a date/time string.