]> granicus.if.org Git - icu/commitdiff
ICU-21959 fix DateIntervalFormat general usage example
authorMarkus Scherer <markus.icu@gmail.com>
Thu, 8 Sep 2022 23:24:43 +0000 (16:24 -0700)
committerMarkus Scherer <markus.icu@gmail.com>
Fri, 9 Sep 2022 01:59:19 +0000 (18:59 -0700)
icu4j/main/classes/core/src/com/ibm/icu/text/DateIntervalFormat.java

index 21c1da5973b234326db80ee8ad1ded34b9e7e9f5..055975537ede2b47780199e8b8127a735ead3ac3 100644 (file)
@@ -206,11 +206,12 @@ import com.ibm.icu.util.UResourceBundle;
  *   // and parses into
  *   DateInterval dtInterval = new DateInterval(1000*3600*24L, 1000*3600*24*2L);
  *   DateIntervalFormat dtIntervalFmt = DateIntervalFormat.getInstance(
- *                   YEAR_MONTH_DAY, Locale("en", "GB", ""));
- *   StringBuffer str = new StringBuffer("");
- *   FieldPosition pos = new FieldPosition(0);
+ *           DateFormat.YEAR_MONTH_DAY, new Locale("en", "GB", ""));
+ *   StringBuffer result = new StringBuffer("");
+ *   FieldPosition pos = new FieldPosition(-1);
  *   // formatting
- *   dtIntervalFmt.format(dtInterval, dateIntervalString, pos);
+ *   dtIntervalFmt.format(dtInterval, result, pos);
+ *   assertEquals("interval", "1–2 January 1970", result.toString());
  *
  * </pre>
  *