From 8fe6eb0b2c025100eeee128cced0a460f24735a5 Mon Sep 17 00:00:00 2001 From: Peter Edberg Date: Wed, 17 Oct 2012 04:49:15 +0000 Subject: [PATCH] ICU-9250 (J) Document that date format S+ fields truncate for S,SS and zero-pad for SSSS+ X-SVN-Rev: 32647 --- .../classes/core/src/com/ibm/icu/text/DateFormat.java | 8 ++++++++ .../core/src/com/ibm/icu/text/SimpleDateFormat.java | 1 + 2 files changed, 9 insertions(+) diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java index e7d4c246628..b7a6d66b8ba 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/DateFormat.java @@ -218,6 +218,14 @@ public abstract class DateFormat extends UFormat { /** * {@icu} FieldPosition selector for 'S' field alignment, * corresponding to the {@link Calendar#MILLISECOND} field. + * + * Note: Time formats that use 'S' can display a maximum of three + * significant digits for fractional seconds, corresponding to millisecond + * resolution and a fractional seconds sub-pattern of SSS. If the + * sub-pattern is S or SS, the fractional seconds value will be truncated + * (not rounded) to the number of display places specified. If the + * fractional seconds sub-pattern is longer than SSS, the additional + * display places will be filled with zeros. * @stable ICU 3.0 */ public final static int FRACTIONAL_SECOND_FIELD = 8; diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java index fb28129bc0a..0a8de3a8366 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/SimpleDateFormat.java @@ -81,6 +81,7 @@ import com.ibm.icu.util.ULocale.Category; * m minute in hour (Number) 30 * s second in minute (Number) 55 * S fractional second (Number) 978 + * (maximum resolution of SSS; truncated if shorter, zero-padded if longer) * E day of week (Text) Tuesday * e* day of week (local 1~7) (Text & Number) Tuesday & 2 * D day in year (Number) 189 -- 2.50.0