mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
6354947: [Fmt-*] Clarify DecimalFormat description of FieldPosition use
Reviewed-by: naoto, rriggs
This commit is contained in:
parent
e6056f2e91
commit
5102cb9120
5 changed files with 131 additions and 70 deletions
|
@ -942,8 +942,19 @@ public class SimpleDateFormat extends DateFormat {
|
|||
*
|
||||
* @param date the date-time value to be formatted into a date-time string.
|
||||
* @param toAppendTo where the new date-time text is to be appended.
|
||||
* @param pos the formatting position. On input: an alignment field,
|
||||
* if desired. On output: the offsets of the alignment field.
|
||||
* @param pos keeps track on the position of the field within
|
||||
* the returned string. For example, given a date-time text
|
||||
* {@code "1996.07.10 AD at 15:08:56 PDT"}, if the given {@code fieldPosition}
|
||||
* is {@link DateFormat#YEAR_FIELD}, the begin index and end index of
|
||||
* {@code fieldPosition} will be set to 0 and 4, respectively.
|
||||
* Notice that if the same date-time field appears more than once in a
|
||||
* pattern, the {@code fieldPosition} will be set for the first occurrence
|
||||
* of that date-time field. For instance, formatting a {@code Date} to the
|
||||
* date-time string {@code "1 PM PDT (Pacific Daylight Time)"} using the
|
||||
* pattern {@code "h a z (zzzz)"} and the alignment field
|
||||
* {@link DateFormat#TIMEZONE_FIELD}, the begin index and end index of
|
||||
* {@code fieldPosition} will be set to 5 and 8, respectively, for the
|
||||
* first occurrence of the timezone pattern character {@code 'z'}.
|
||||
* @return the formatted date-time string.
|
||||
* @exception NullPointerException if any of the parameters is {@code null}.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue