12ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* GENERATED SOURCE. DO NOT MODIFY. */
2f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// © 2016 and later: Unicode, Inc. and others.
3f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html#License
42ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/*
57241d93e30f4c7c527c019cd6ca3a791ca22d9b2Fredrik Roubert *   Copyright (C) 1996-2016, International Business Machines
62ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *   Corporation and others.  All Rights Reserved.
72ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */
82ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
92ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpackage android.icu.text;
102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.io.IOException;
122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.io.InvalidObjectException;
132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.io.ObjectInputStream;
142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.text.FieldPosition;
152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.text.Format;
162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.text.ParseException;
172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.text.ParsePosition;
182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Arrays;
192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Date;
202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.EnumSet;
212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.HashMap;
222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.List;
232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Locale;
242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Map;
252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.MissingResourceException;
262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.impl.ICUResourceBundle;
282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.impl.RelativeDateFormat;
292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.Calendar;
302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.GregorianCalendar;
312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.TimeZone;
322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.ULocale;
332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.ULocale.Category;
342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/**
361537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu enhancement]</strong> ICU's replacement for {@link java.text.DateFormat}.&nbsp;Methods, fields, and other functionality specific to ICU are labeled '<strong>[icu]</strong>'.
371c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a
402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * language-independent manner. The date/time formatting subclass, such as SimpleDateFormat, allows for formatting
4108ae9f2909b2ec37f755dac4372553437e9d7cf6Paul Duffin * (i.e., date -&gt; text), parsing (text -&gt; date), and normalization. The date is represented as a <code>Date</code>
422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * object or as the milliseconds since January 1, 1970, 00:00:00 GMT.
431c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * DateFormat helps you to format and parse dates for any locale. Your code can be completely independent of the locale
462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * conventions for months, days of the week, or even the calendar format: lunar vs. solar. It provides many class
472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * methods for obtaining default date/time formatters based on the default for a given locale and a number of formatting
482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * styles or arbitrary "skeletons".
492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ol>
502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>The formatting styles include FULL, LONG, MEDIUM, and SHORT. More detail and examples of using these styles are
512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * provided in the method descriptions.
522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>The formatting styles only cover a fraction of the necessary usage. You often need to have just certain
532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * combinations of fields, like Month and Year, but have it to be formatted appropriate to a given locale. This is done
542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * using the (misnamed) getPatternInstance() method, supplying a skeleton. There are a number of constants that have
552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * common pre-defined skeletons, such as {@link #MINUTE_SECOND} for something like "13:45" or {@link #YEAR_ABBR_MONTH}
562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for something like "Sept 2012".
572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </ol>
581c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * To format a date for the current Locale, use one of the static factory methods:
611c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <pre>
632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * myString = DateFormat.getDateInstance().format(myDate);
642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * myString = DateFormat.getPatternInstance(DateFormat.YEAR_ABBR_MONTH).format(myDate);
652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </pre>
662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * If you are formatting multiple numbers, it is more efficient to get the format and use it multiple times so that the
682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * system doesn't have to fetch the information about the local language and country conventions multiple times.
691c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <pre>
712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * DateFormat df = DateFormat.getDateInstance();
722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for (int i = 0; i &lt; a.length; ++i) {
732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *     output.println(df.format(myDate[i]) + &quot;; &quot;);
742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * }
752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </pre>
762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * To format a date for a different Locale, specify it in the call to getDateInstance().
781c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <pre>
802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </pre>
822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * You can use a DateFormat to parse also.
841c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <pre>
862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * myDate = df.parse(myString);
872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </pre>
882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * There are many static factory methods available. Use getDateInstance to get the normal date format for that country.
902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Use getTimeInstance to get the time format for that country. Use getDateTimeInstance to get a date and time format.
912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * You can pass in different options to these factory methods to control the length of the result; from SHORT to MEDIUM
922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * to LONG to FULL. The exact result depends on the locale, but generally:
932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ul>
942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>SHORT is completely numeric, such as 12.13.52 or 3:30pm
952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>MEDIUM is longer, such as Jan 12, 1952
962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>LONG is longer, such as January 12, 1952 or 3:30:32pm
972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST.
982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </ul>
991c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
1002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
1012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Use getPatternInstance to format with a skeleton. Typically this is with a predefined skeleton, like
1022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * {@link #YEAR_ABBR_MONTH} for something like "Sept 2012". If you don't want to use one of the predefined skeletons,
1032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * you can supply your own. The skeletons are like the patterns in SimpleDateFormat, except they:
1042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ol>
1052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>only keep the field pattern letter and ignore all other parts in a pattern, such as space, punctuation, and
1062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * string literals.
1072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>are independent of the order of fields.
1082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>ignore certain differences in the field's pattern letter length:
1092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ol>
1102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>For those non-digit calendar fields, the pattern letter length is important, such as MMM, MMMM, and MMMMM; E and
1112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * EEEE, and the field's pattern letter length is honored.
1122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>For the digit calendar fields, such as M or MM, d or dd, yy or yyyy, the field pattern length is ignored and the
1132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * best match, which is defined in date time patterns, will be returned without honor the field pattern letter length in
1142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * skeleton.
1152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </ol>
1162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </ol>
1171c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
1182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
1192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * You can also set the time zone on the format if you wish. If you want even more control over the format or parsing,
1202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * (or want to give your users more control), you can try casting the DateFormat you get from the factory methods to a
1212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * SimpleDateFormat. This will work for the majority of countries; just remember to put it in a try block in case you
1222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * encounter an unusual one.
1231c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
1242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>
1252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * You can also use forms of the parse and format methods with ParsePosition and FieldPosition to allow you to
1262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ul>
1272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>progressively parse through pieces of a string.
1282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>align any particular field, or find out where it is for selection on the screen.
1292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </ul>
1301c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
13108ae9f2909b2ec37f755dac4372553437e9d7cf6Paul Duffin * <h3>Synchronization</h3>
1321c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
1332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple
1342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * threads access a format concurrently, it must be synchronized externally.
1351c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert *
1362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see UFormat
1372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see NumberFormat
1382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see SimpleDateFormat
1392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.Calendar
1402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.GregorianCalendar
1412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.TimeZone
1422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @author Mark Davis, Chen-Lieh Huang, Alan Liu
1432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */
1442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpublic abstract class DateFormat extends UFormat {
1452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
1472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * The calendar that <code>DateFormat</code> uses to produce the time field
1482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * values needed to implement date and time formatting.  Subclasses should
1492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * initialize this to a calendar appropriate for the locale associated with
1502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * this <code>DateFormat</code>.
1512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @serial
1522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    protected Calendar calendar;
1542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
1562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * The number formatter that <code>DateFormat</code> uses to format numbers
1572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in dates and times.  Subclasses should initialize this to a number format
1582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * appropriate for the locale associated with this <code>DateFormat</code>.
1592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @serial
1602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    protected NumberFormat numberFormat;
1622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
1642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'G' field alignment,
1652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#ERA} field.
1662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int ERA_FIELD = 0;
1682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
1702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'y' field alignment,
1712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#YEAR} field.
1722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int YEAR_FIELD = 1;
1742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
1762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'M' field alignment,
1772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#MONTH} field.
1782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int MONTH_FIELD = 2;
1802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
1822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'd' field alignment,
1832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#DATE} field.
1842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int DATE_FIELD = 3;
1862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
1882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'k' field alignment,
1892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#HOUR_OF_DAY} field.
1902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock.
1912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * For example, 23:59 + 01:00 results in 24:59.
1922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int HOUR_OF_DAY1_FIELD = 4;
1942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
1962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'H' field alignment,
1972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#HOUR_OF_DAY} field.
1982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock.
1992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * For example, 23:59 + 01:00 results in 00:59.
2002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int HOUR_OF_DAY0_FIELD = 5;
2022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'm' field alignment,
2052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#MINUTE} field.
2062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int MINUTE_FIELD = 6;
2082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 's' field alignment,
2112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#SECOND} field.
2122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int SECOND_FIELD = 7;
2142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2161537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'S' field alignment,
2172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#MILLISECOND} field.
2182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
2192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Note: Time formats that use 'S' can display a maximum of three
2202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * significant digits for fractional seconds, corresponding to millisecond
2212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * resolution and a fractional seconds sub-pattern of SSS. If the
2222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * sub-pattern is S or SS, the fractional seconds value will be truncated
2232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * (not rounded) to the number of display places specified. If the
2242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * fractional seconds sub-pattern is longer than SSS, the additional
2252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * display places will be filled with zeros.
2262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int FRACTIONAL_SECOND_FIELD = 8;
2282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Alias for FRACTIONAL_SECOND_FIELD.
2312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int MILLISECOND_FIELD = FRACTIONAL_SECOND_FIELD;
2332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'E' field alignment,
2362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#DAY_OF_WEEK} field.
2372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int DAY_OF_WEEK_FIELD = 9;
2392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'D' field alignment,
2422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#DAY_OF_YEAR} field.
2432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int DAY_OF_YEAR_FIELD = 10;
2452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'F' field alignment,
2482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#DAY_OF_WEEK_IN_MONTH} field.
2492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int DAY_OF_WEEK_IN_MONTH_FIELD = 11;
2512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'w' field alignment,
2542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#WEEK_OF_YEAR} field.
2552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int WEEK_OF_YEAR_FIELD = 12;
2572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'W' field alignment,
2602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#WEEK_OF_MONTH} field.
2612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int WEEK_OF_MONTH_FIELD = 13;
2632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'a' field alignment,
2662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#AM_PM} field.
2672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int AM_PM_FIELD = 14;
2692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'h' field alignment,
2722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#HOUR} field.
2732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * HOUR1_FIELD is used for the one-based 12-hour clock.
2742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * For example, 11:30 PM + 1 hour results in 12:30 AM.
2752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int HOUR1_FIELD = 15;
2772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'K' field alignment,
2802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#HOUR} field.
2812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * HOUR0_FIELD is used for the zero-based 12-hour clock.
2822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * For example, 11:30 PM + 1 hour results in 00:30 AM.
2832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int HOUR0_FIELD = 16;
2852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * FieldPosition selector for 'z' field alignment,
2882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#ZONE_OFFSET} and
2892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * {@link Calendar#DST_OFFSET} fields.
2902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int TIMEZONE_FIELD = 17;
2922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
2941537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'Y' field alignment,
2952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#YEAR_WOY} field.
2962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
2972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int YEAR_WOY_FIELD = 18;
2982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3001537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'e' field alignment,
3012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#DOW_LOCAL} field.
3022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int DOW_LOCAL_FIELD = 19;
3042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3061537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'u' field alignment,
3072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#EXTENDED_YEAR} field.
3082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int EXTENDED_YEAR_FIELD = 20;
3102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3121537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'g' field alignment,
3132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#JULIAN_DAY} field.
3142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int JULIAN_DAY_FIELD = 21;
3162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3181537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'A' field alignment,
3192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#MILLISECONDS_IN_DAY} field.
3202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int MILLISECONDS_IN_DAY_FIELD = 22;
3222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3241537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'Z' field alignment,
3252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#ZONE_OFFSET} and
3262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * {@link Calendar#DST_OFFSET} fields.
3272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int TIMEZONE_RFC_FIELD = 23;
3292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3311537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'v' field alignment,
3322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#ZONE_OFFSET} and
3332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * {@link Calendar#DST_OFFSET} fields.  This displays the generic zone
3342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * name, if available.
3352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int TIMEZONE_GENERIC_FIELD = 24;
3372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3391537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'c' field alignment,
3402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#DAY_OF_WEEK} field.
3412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * This displays the stand alone day name, if available.
3422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int STANDALONE_DAY_FIELD = 25;
3442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3461537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'L' field alignment,
3472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#MONTH} field.
3482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * This displays the stand alone month name, if available.
3492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int STANDALONE_MONTH_FIELD = 26;
3512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3531537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'Q' field alignment,
3542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#MONTH} field.
3552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * This displays the quarter.
3562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int QUARTER_FIELD = 27;
3582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3601537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'q' field alignment,
3612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#MONTH} field.
3622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * This displays the stand alone quarter, if available.
3632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int STANDALONE_QUARTER_FIELD = 28;
3652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3671537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'V' field alignment,
3682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#ZONE_OFFSET} and
3692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * {@link Calendar#DST_OFFSET} fields.  This displays the fallback timezone
3702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * name when VVVV is specified, and the short standard or daylight
3712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * timezone name ignoring commonlyUsed when a single V is specified.
3722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int TIMEZONE_SPECIAL_FIELD = 29;
3742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3761537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'U' field alignment,
3772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#YEAR} field.
3782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * This displays the cyclic year name, if available.
3792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int YEAR_NAME_FIELD = 30;
3812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3831537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'O' field alignment,
3842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#ZONE_OFFSET} and
3852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * {@link Calendar#DST_OFFSET} fields.  This displays the
3862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * localized GMT format.
3872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31;
3892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3911537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'X' field alignment,
3922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#ZONE_OFFSET} and
3932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * {@link Calendar#DST_OFFSET} fields.  This displays the
3942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * ISO 8601 local time offset format or UTC indicator ("Z").
3952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
3962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int TIMEZONE_ISO_FIELD = 32;
3972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
3982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
3991537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'x' field alignment,
4002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#ZONE_OFFSET} and
4012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * {@link Calendar#DST_OFFSET} fields.  This displays the
4022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * ISO 8601 local time offset format.
4032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
4042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static int TIMEZONE_ISO_LOCAL_FIELD = 33;
4052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
4062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
4071537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector for 'r' field alignment,
4082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * corresponding to the {@link Calendar#EXTENDED_YEAR} field
4092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * of the *related* calendar which may be different than the
4102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * one used by the DateFormat.
4112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated This API is ICU internal only.
412836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller     * @hide draft / provisional / internal are hidden on Android
4132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
4142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
4152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    final static int RELATED_YEAR = 34;
4162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
4172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
4181c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * <strong>[icu]</strong> FieldPosition selector for 'b' field alignment.
4191c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * No related Calendar field.
4201c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * This displays the fixed day period (am/pm/midnight/noon).
4211c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * @hide draft / provisional / internal are hidden on Android
4221c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     */
4231c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    final static int AM_PM_MIDNIGHT_NOON_FIELD = 35;
4241c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
4251c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    /**
4261c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * <strong>[icu]</strong> FieldPosition selector for 'B' field alignment.
4271c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * No related Calendar field.
4281c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * This displays the flexible day period.
4291c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * @hide draft / provisional / internal are hidden on Android
4301c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     */
4311c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    final static int FLEXIBLE_DAY_PERIOD_FIELD = 36;
4321c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
4331c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    /**
4341537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> FieldPosition selector time separator,
4352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * no related Calendar field. No pattern character is currently
4362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * defined for this.
4371c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * @deprecated This API is ICU internal only.
438836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller     * @hide draft / provisional / internal are hidden on Android
4392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
4401c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    @Deprecated
4411c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    public final static int TIME_SEPARATOR = 37;
4422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
4432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
4441537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Number of FieldPosition selectors for DateFormat.
4452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Valid selectors range from 0 to FIELD_COUNT-1.
446f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert     * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
447ff2b69bcfd12088a375804686b38e0d6bbf141acPaul Duffin     * @hide unsupported on Android
4482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
449f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert    @Deprecated
4501c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    public final static int FIELD_COUNT = 38;
4512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // A previous comment for the above stated that we must have
4522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // DateFormat.FIELD_COUNT == DateFormatSymbols.patternChars.length()
4532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // but that does not seem to be the case, and in fact since there is
4542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // no pattern character currently defined for TIME_SEPARATOR it is
4552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // currently the case that
4562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // DateFormat.FIELD_COUNT == DateFormatSymbols.patternChars.length() + 1
4572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
4581c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
4592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
4602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * boolean attributes
4612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
4621c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    public enum BooleanAttribute {
4631c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        /**
4641c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * indicates whitespace tolerance. Also included is trailing dot tolerance.
4652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
4662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        PARSE_ALLOW_WHITESPACE,
4671c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        /**
4681c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * indicates tolerance of numeric data when String data may be assumed.
4691c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * e.g. YEAR_NAME_FIELD
4702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
4711c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        PARSE_ALLOW_NUMERIC,
4721c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        /**
4732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * indicates tolerance of pattern mismatch between input data and specified format pattern.
4741c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * e.g. accepting "September" for a month pattern of MMM ("Sep")
4752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
4761c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        PARSE_MULTIPLE_PATTERNS_FOR_MATCH,
4772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
4782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * indicates tolerance of a partial literal match
4792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * e.g. accepting "--mon-02-march-2011" for a pattern of "'--: 'EEE-WW-MMMM-yyyy"
4802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
4812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        PARSE_PARTIAL_LITERAL_MATCH,
4822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
4832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * alias of PARSE_PARTIAL_LITERAL_MATCH
4842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @deprecated
485836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller         * @hide draft / provisional / internal are hidden on Android
4862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
4872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        @Deprecated
4882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        PARSE_PARTIAL_MATCH
4892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    };
4901c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
4912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
4922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * boolean attributes for this instance. Inclusion in this is indicates a true condition.
4932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
4941c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    private EnumSet<BooleanAttribute> booleanAttributes = EnumSet.allOf(BooleanAttribute.class);
4952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
4962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /*
4972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Capitalization setting, hoisted to DateFormat ICU 53
4982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Note that SimpleDateFormat serialization may call getContext/setContext to read/write
4992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * this for compatibility with serialization for its old copy of capitalizationSetting.
5002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @serial
5012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
5022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private DisplayContext capitalizationSetting = DisplayContext.CAPITALIZATION_NONE;
5032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
5042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final int currentSerialVersion = 1;
5052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
5062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
5072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Describes the version of <code>DateFormat</code> present on the stream.
5082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Possible values are:
5092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <ul>
5102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <li><b>0</b> (or uninitialized): the pre-ICU-53 version
5112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
5122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <li><b>1</b>: ICU 53, adds serialVersionOnStream and capitalizationSetting
5132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * </ul>
5142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * When streaming out a <code>DateFormat</code>, the most recent format
5152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * (corresponding to the highest allowable <code>serialVersionOnStream</code>)
5162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * is always written.
5172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
5182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @serial
5192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
5202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private int serialVersionOnStream = currentSerialVersion;
5212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
5222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // Proclaim serial compatibility with 1.1 FCS
5232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private static final long serialVersionUID = 7218322306649953788L;
5242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
5252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
5262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Formats a time object into a time string. Examples of time objects
5272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * are a time value expressed in milliseconds and a Date object.
5282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param obj must be a Number or a Date or a Calendar.
5292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param toAppendTo the string buffer for the returning time string.
5302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the formatted time string.
5312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param fieldPosition keeps track of the position of the field
5322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * within the returned string.
5332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * On input: an alignment field,
5342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * if desired. On output: the offsets of the alignment field. For
5352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * example, given a time text "1996.07.10 AD at 15:08:56 PDT",
5362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * if the given fieldPosition is DateFormat.YEAR_FIELD, the
5372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * begin index and end index of fieldPosition will be set to
5382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * 0 and 4, respectively.
5392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Notice that if the same time field appears
5402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * more than once in a pattern, the fieldPosition will be set for the first
5412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * occurrence of that time field. For instance, formatting a Date to
5422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
5432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
5442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the begin index and end index of fieldPosition will be set to
5452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * 5 and 8, respectively, for the first occurrence of the timezone
5462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * pattern character 'z'.
5472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see java.text.Format
5482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
549f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert    @Override
5502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final StringBuffer format(Object obj, StringBuffer toAppendTo,
5512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                     FieldPosition fieldPosition)
5522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
5532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (obj instanceof Calendar)
5542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return format( (Calendar)obj, toAppendTo, fieldPosition );
5552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        else if (obj instanceof Date)
5562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return format( (Date)obj, toAppendTo, fieldPosition );
5572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        else if (obj instanceof Number)
5582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return format( new Date(((Number)obj).longValue()),
5592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                          toAppendTo, fieldPosition );
5602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        else
5612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            throw new IllegalArgumentException("Cannot format given Object (" +
5622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                               obj.getClass().getName() + ") as a Date");
5632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
5642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
5652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
5662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Formats a date into a date/time string.
5672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal a Calendar set to the date and time to be formatted
5682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * into a date/time string.  When the calendar type is different from
5692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the internal calendar held by this DateFormat instance, the date
5702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * and the time zone will be inherited from the input calendar, but
5712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * other calendar field values will be calculated by the internal calendar.
5722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param toAppendTo the string buffer for the returning date/time string.
5732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param fieldPosition keeps track of the position of the field
5742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * within the returned string.
5752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * On input: an alignment field,
5762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * if desired. On output: the offsets of the alignment field. For
5772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * example, given a time text "1996.07.10 AD at 15:08:56 PDT",
5782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * if the given fieldPosition is DateFormat.YEAR_FIELD, the
5792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * begin index and end index of fieldPosition will be set to
5802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * 0 and 4, respectively.
5812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Notice that if the same time field appears
5822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * more than once in a pattern, the fieldPosition will be set for the first
5832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * occurrence of that time field. For instance, formatting a Date to
5842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
5852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
5862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the begin index and end index of fieldPosition will be set to
5872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * 5 and 8, respectively, for the first occurrence of the timezone
5882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * pattern character 'z'.
5892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the formatted date/time string.
5902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
5912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public abstract StringBuffer format(Calendar cal, StringBuffer toAppendTo,
5922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                        FieldPosition fieldPosition);
5932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
5942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
5952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Formats a Date into a date/time string.
5962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param date a Date to be formatted into a date/time string.
5972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param toAppendTo the string buffer for the returning date/time string.
5982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param fieldPosition keeps track of the position of the field
5992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * within the returned string.
6002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * On input: an alignment field,
6012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * if desired. On output: the offsets of the alignment field. For
6022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * example, given a time text "1996.07.10 AD at 15:08:56 PDT",
6032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * if the given fieldPosition is DateFormat.YEAR_FIELD, the
6042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * begin index and end index of fieldPosition will be set to
6052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * 0 and 4, respectively.
6062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Notice that if the same time field appears
6072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * more than once in a pattern, the fieldPosition will be set for the first
6082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * occurrence of that time field. For instance, formatting a Date to
6092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
6102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
6112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the begin index and end index of fieldPosition will be set to
6122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * 5 and 8, respectively, for the first occurrence of the timezone
6132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * pattern character 'z'.
6142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the formatted date/time string.
6152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
6162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public StringBuffer format(Date date, StringBuffer toAppendTo,
6172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                     FieldPosition fieldPosition) {
6182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Use our Calendar object
6192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        calendar.setTime(date);
6202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return format(calendar, toAppendTo, fieldPosition);
6212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
6222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
6232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
6242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Formats a Date into a date/time string.
6252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param date the time value to be formatted into a time string.
6262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the formatted time string.
6272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
6282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final String format(Date date)
6292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
6302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return format(date, new StringBuffer(64),new FieldPosition(0)).toString();
6312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
6322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
6332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
6342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Parses a date/time string. For example, a time text "07/10/96 4:5 PM, PDT"
6352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * will be parsed into a Date that is equivalent to Date(837039928046).
6362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Parsing begins at the beginning of the string and proceeds as far as
6372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * possible.  Assuming no parse errors were encountered, this function
6382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * doesn't return any information about how much of the string was consumed
6392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * by the parsing.  If you need that information, use a version of
6402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * parse() that takes a ParsePosition.
6412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p> By default, parsing is lenient: If the input is not in the form used
6432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * by this object's format method but can still be parsed as a date, then
6442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the parse succeeds.  Clients may insist on strict adherence to the
6452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * format by calling setLenient(false).
6462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p> Note that the normal date formats associated with some calendars - such
6482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * as the Chinese lunar calendar - do not specify enough fields to enable
6492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates to be parsed unambiguously. In the case of the Chinese lunar
6502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * calendar, while the year within the current 60-year cycle is specified,
6512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the number of such cycles since the start date of the calendar (in the
6522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * ERA field of the Calendar object) is not normally part of the format,
6532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * and parsing may assume the wrong era. For cases such as this it is
6542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * recommended that clients parse using the parse method that takes a Calendar
6552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * with the Calendar passed in set to the current date, or to a date
6562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * within the era/cycle that should be assumed if absent in the format.
6572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param text  The date/time string to be parsed
6592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return      A Date, or null if the input could not be parsed
6612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @exception  ParseException  If the given string cannot be parsed as a date.
6632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see #parse(String, ParsePosition)
6652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
6662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Date parse(String text) throws ParseException
6672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
6682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        ParsePosition pos = new ParsePosition(0);
6692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Date result = parse(text, pos);
6702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (pos.getIndex() == 0) // ICU4J
6712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            throw new ParseException("Unparseable date: \"" + text + "\"" ,
6722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                     pos.getErrorIndex()); // ICU4J
6732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return result;
6742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
6752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
6762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
6772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Parses a date/time string according to the given parse position.
6782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * For example, a time text "07/10/96 4:5 PM, PDT" will be parsed
6792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * into a Calendar that is equivalent to Date(837039928046). Before
6802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * calling this method the caller should initialize the calendar
6812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in one of two ways (unless existing field information is to be kept):
6822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * (1) clear the calendar, or (2) set the calendar to the current date
6832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * (or to any date whose fields should be used to supply values that
6842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * are missing in the parsed date). For example, Chinese calendar dates
6852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * do not normally provide an era/cycle; in this case the calendar that
6862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * is passed in should be set to a date within the era that should be
6872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * assumed, normally the current era.
6882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p> By default, parsing is lenient: If the input is not in the form used
6902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * by this object's format method but can still be parsed as a date, then
6912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the parse succeeds.  Clients may insist on strict adherence to the
6922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * format by calling setLenient(false).
6932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see #setLenient(boolean)
6952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param text  The date/time string to be parsed
6972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
6982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar set on input to the date and time to be used
6992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              for missing values in the date/time string being parsed,
7002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              and set on output to the parsed date/time. In general, this
7012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              should be initialized before calling this method - either
7022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              cleared or set to the current date, depending on desired
7032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              behavior. If this parse fails, the calendar may still
7042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              have been modified. When the calendar type is different
7052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              from the internal calendar held by this DateFormat
7062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              instance, calendar field values will be parsed based
7072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              on the internal calendar initialized with the time and
7082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              the time zone taken from this calendar, then the
7092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              parse result (time in milliseconds and time zone) will
7102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              be set back to this calendar.
7112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
7122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param pos   On input, the position at which to start parsing; on
7132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              output, the position at which parsing terminated, or the
7142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              start position if the parse failed.
7152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
7162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public abstract void parse(String text, Calendar cal, ParsePosition pos);
7172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
7182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
7192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Parses a date/time string according to the given parse position.  For
7202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
7212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * that is equivalent to Date(837039928046).
7222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
7232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p> By default, parsing is lenient: If the input is not in the form used
7242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * by this object's format method but can still be parsed as a date, then
7252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the parse succeeds.  Clients may insist on strict adherence to the
7262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * format by calling setLenient(false).
7272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
7282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p> Note that the normal date formats associated with some calendars - such
7292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * as the Chinese lunar calendar - do not specify enough fields to enable
7302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates to be parsed unambiguously. In the case of the Chinese lunar
7312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * calendar, while the year within the current 60-year cycle is specified,
7322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the number of such cycles since the start date of the calendar (in the
7332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * ERA field of the Calendar object) is not normally part of the format,
7342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * and parsing may assume the wrong era. For cases such as this it is
7352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * recommended that clients parse using the parse method that takes a Calendar
7362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * with the Calendar passed in set to the current date, or to a date
7372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * within the era/cycle that should be assumed if absent in the format.
7382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
7392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see #setLenient(boolean)
7402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
7412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param text  The date/time string to be parsed
7422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
7432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param pos   On input, the position at which to start parsing; on
7442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              output, the position at which parsing terminated, or the
7452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              start position if the parse failed.
7462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
7472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return      A Date, or null if the input could not be parsed
7482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
7492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Date parse(String text, ParsePosition pos) {
7502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Date result = null;
7512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        int start = pos.getIndex();
7522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        TimeZone tzsav = calendar.getTimeZone();
7532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        calendar.clear();
7542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        parse(text, calendar, pos);
7552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (pos.getIndex() != start) {
7562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            try {
7572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                result = calendar.getTime();
7582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            } catch (IllegalArgumentException e) {
7592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                // This occurs if the calendar is non-lenient and there is
7602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                // an out-of-range field.  We don't know which field was
7612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                // illegal so we set the error index to the start.
7622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                pos.setIndex(start);
7632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                pos.setErrorIndex(start);
7642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
7652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
7662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Restore TimeZone
7672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        calendar.setTimeZone(tzsav);
7682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return result;
7692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
7702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
7712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
7722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Parses a date/time string into an Object.  This convenience method simply
7732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * calls parse(String, ParsePosition).
7742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
7752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see #parse(String, ParsePosition)
7762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
777f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert    @Override
7782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Object parseObject (String source, ParsePosition pos)
7792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
7802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return parse(source, pos);
7812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
7822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
7832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
7841537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for empty style pattern.
7852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
7862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int NONE = -1;
7872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
7882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
7892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Constant for full style pattern.
7902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
7912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int FULL = 0;
7922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
7932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
7942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Constant for long style pattern.
7952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
7962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int LONG = 1;
7972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
7982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
7992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Constant for medium style pattern.
8002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int MEDIUM = 2;
8022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Constant for short style pattern.
8052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int SHORT = 3;
8072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Constant for default style pattern.  Its value is MEDIUM.
8102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int DEFAULT = MEDIUM;
8122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8141537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for relative style mask.
8152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int RELATIVE = (1 << 7);
8172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8191537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for relative full style pattern.
8202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int RELATIVE_FULL = RELATIVE | FULL;
8222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8241537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for relative style pattern.
8252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int RELATIVE_LONG = RELATIVE | LONG;
8272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8291537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for relative style pattern.
8302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int RELATIVE_MEDIUM = RELATIVE | MEDIUM;
8322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8341537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for relative style pattern.
8352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int RELATIVE_SHORT = RELATIVE | SHORT;
8372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8391537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for relative default style pattern.
8402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final int RELATIVE_DEFAULT = RELATIVE | DEFAULT;
8422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /*
8442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * DATES
8452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8481537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year.
8492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR = "y";
8512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8531537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with quarter.
8542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String QUARTER = "QQQQ";
8562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8581537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with abbreviated quarter.
8592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_QUARTER = "QQQ";
8612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8631537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year and quarter.
8642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_QUARTER = "yQQQQ";
8662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8681537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year and abbreviated quarter.
8692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_ABBR_QUARTER = "yQQQ";
8712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8731537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with month.
8742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String MONTH = "MMMM";
8762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8781537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with abbreviated month.
8792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_MONTH = "MMM";
8812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8831537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with numeric month.
8842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String NUM_MONTH = "M";
8862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8881537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year and month.
8892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_MONTH = "yMMMM";
8912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8931537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year and abbreviated month.
8942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
8952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_ABBR_MONTH = "yMMM";
8962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
8972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
8981537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year and numeric month.
8992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_NUM_MONTH = "yM";
9012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9031537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with day.
9042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String DAY = "d";
9062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9081537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year, month, and day.
9092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_MONTH_DAY = "yMMMMd";
9122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9141537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year, abbreviated month, and day.
9152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_ABBR_MONTH_DAY = "yMMMd";
9182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9201537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year, numeric month, and day.
9212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_NUM_MONTH_DAY = "yMd";
9242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9261537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with weekday.
9272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String WEEKDAY = "EEEE";
9292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9311537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with abbreviated weekday.
9322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_WEEKDAY = "E";
9342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9361537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year, month, weekday, and day.
9372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_MONTH_WEEKDAY_DAY = "yMMMMEEEEd";
9402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9421537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year, abbreviated month, weekday, and day.
9432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_ABBR_MONTH_WEEKDAY_DAY = "yMMMEd";
9462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9481537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with year, numeric month, weekday, and day.
9492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String YEAR_NUM_MONTH_WEEKDAY_DAY = "yMEd";
9522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9541537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with long month and day.
9552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String MONTH_DAY = "MMMMd";
9582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9601537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with abbreviated month and day.
9612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_MONTH_DAY = "MMMd";
9642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9661537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with numeric month and day.
9672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String NUM_MONTH_DAY = "Md";
9702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9721537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with month, weekday, and day.
9732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String MONTH_WEEKDAY_DAY = "MMMMEEEEd";
9762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9781537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with abbreviated month, weekday, and day.
9792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_MONTH_WEEKDAY_DAY = "MMMEd";
9822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
9832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9841537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with numeric month, weekday, and day.
9852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
9862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String NUM_MONTH_WEEKDAY_DAY = "MEd";
9881c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
9892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
9902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * List of all of the date skeleton constants for iteration.
9912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Note that this is fragile; be sure to add any values that are added above.
9922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated This API is ICU internal only.
99393cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
994836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller     * @hide draft / provisional / internal are hidden on Android
9952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
9962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
9972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final List<String> DATE_SKELETONS = Arrays.asList(
9982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR,
9992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            QUARTER,
10002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ABBR_QUARTER,
10012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_QUARTER,
10022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_ABBR_QUARTER,
10032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            MONTH,
10042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ABBR_MONTH,
10052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            NUM_MONTH,
10062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_MONTH,
10072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_ABBR_MONTH,
10082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_NUM_MONTH,
10092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            DAY,
10102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_MONTH_DAY,
10112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_ABBR_MONTH_DAY,
10122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_NUM_MONTH_DAY,
10132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            WEEKDAY,
10142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ABBR_WEEKDAY,
10152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_MONTH_WEEKDAY_DAY,
10162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_ABBR_MONTH_WEEKDAY_DAY,
10172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            YEAR_NUM_MONTH_WEEKDAY_DAY,
10182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            MONTH_DAY,
10192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ABBR_MONTH_DAY,
10202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            NUM_MONTH_DAY,
10212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            MONTH_WEEKDAY_DAY,
10222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ABBR_MONTH_WEEKDAY_DAY,
10232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            NUM_MONTH_WEEKDAY_DAY);
10242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /*
10262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * TIMES
10272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10301537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour, with the locale's preferred hour format (12 or 24).
10312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR = "j";
10332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10351537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour in 24-hour presentation.
10362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR24 = "H";
10382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10401537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with minute.
10412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String MINUTE = "m";
10432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10451537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour and minute, with the locale's preferred hour format (12 or 24).
10462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
10472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR_MINUTE = "jm";
10492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10511537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour and minute in 24-hour presentation.
10522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
10532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR24_MINUTE = "Hm";
10552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10571537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with second.
10582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String SECOND = "s";
10602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10621537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour, minute, and second,
10632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * with the locale's preferred hour format (12 or 24).
10642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
10652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR_MINUTE_SECOND = "jms";
10672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10691537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour, minute, and second in
10702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * 24-hour presentation.
10712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
10722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR24_MINUTE_SECOND = "Hms";
10742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
10752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10761537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with minute and second.
10772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Used in combinations date + time, date + time + zone, or time + zone.
10782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String MINUTE_SECOND = "ms";
10801c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
10812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
10822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * List of all of the time skeleton constants for iteration.
10832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Note that this is fragile; be sure to add any values that are added above.
10842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated This API is ICU internal only.
108593cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
1086836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller     * @hide draft / provisional / internal are hidden on Android
10872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
10882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
10892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final List<String> TIME_SKELETONS = Arrays.asList(
10902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            HOUR,
10912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            HOUR24,
10922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            MINUTE,
10932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            HOUR_MINUTE,
10942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            HOUR24_MINUTE,
10952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            SECOND,
10962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            HOUR_MINUTE_SECOND,
10972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            HOUR24_MINUTE_SECOND,
10982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            MINUTE_SECOND);
10991c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
11002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /*
11012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * TIMEZONES
11022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
11042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11051537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for <i>generic location format</i>, such as Los Angeles Time;
11062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * used in combinations date + time + zone, or time + zone.
11072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
11082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
11092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String LOCATION_TZ = "VVVV";
11111c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
11122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11131537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for <i>generic non-location format</i>, such as Pacific Time;
11142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * used in combinations date + time + zone, or time + zone.
11152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
11162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
11172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String GENERIC_TZ = "vvvv";
11191c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
11202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11211537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for <i>generic non-location format</i>, abbreviated if possible, such as PT;
11222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * used in combinations date + time + zone, or time + zone.
11232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
11242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
11252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_GENERIC_TZ = "v";
11271c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
11282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11291537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for <i>specific non-location format</i>, such as Pacific Daylight Time;
11302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * used in combinations date + time + zone, or time + zone.
11312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
11322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
11332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String SPECIFIC_TZ = "zzzz";
11351c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
11362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11371537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for <i>specific non-location format</i>, abbreviated if possible, such as PDT;
11382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * used in combinations date + time + zone, or time + zone.
11392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
11402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
11412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_SPECIFIC_TZ = "z";
11431c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
11442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11451537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for <i>localized GMT/UTC format</i>, such as GMT+8:00 or HPG-8:00;
11462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * used in combinations date + time + zone, or time + zone.
11472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
11482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
11492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_UTC_TZ = "ZZZZ";
11512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
11522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * List of all of the zone skeleton constants for iteration.
11542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Note that this is fragile; be sure to add any values that are added above.
11552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated This API is ICU internal only.
115693cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
1157836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller     * @hide draft / provisional / internal are hidden on Android
11582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
11602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final List<String> ZONE_SKELETONS = Arrays.asList(
11612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            LOCATION_TZ,
11622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            GENERIC_TZ,
11632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ABBR_GENERIC_TZ,
11642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            SPECIFIC_TZ,
11652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ABBR_SPECIFIC_TZ,
11662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ABBR_UTC_TZ);
11672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
11682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /*
11692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * deprecated skeleton constants
11702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
11722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11731537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with standalone month.
11742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated ICU 50 Use {@link #MONTH} instead.
117593cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
11762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
11782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String STANDALONE_MONTH = "LLLL";
11792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
11802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11811537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with standalone abbreviated month.
11822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated ICU 50 Use {@link #ABBR_MONTH} instead.
118393cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
11842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
11862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String ABBR_STANDALONE_MONTH = "LLL";
11872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
11882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11891537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour, minute, and generic timezone.
11902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated ICU 50 Use instead {@link #HOUR_MINUTE}+{@link #ABBR_GENERIC_TZ} or some other timezone presentation.
119193cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
11922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
11932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
11942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR_MINUTE_GENERIC_TZ = "jmv";
11952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
11962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
11971537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour, minute, and timezone.
11982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated ICU 50 Use instead {@link #HOUR_MINUTE}+{@link #ABBR_SPECIFIC_TZ} or some other timezone presentation.
119993cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
12002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
12022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR_MINUTE_TZ = "jmz";
12032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
12051537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour and generic timezone.
12062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated ICU 50 Use instead {@link #HOUR}+{@link #ABBR_GENERIC_TZ} or some other timezone presentation.
120793cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
12082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
12102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR_GENERIC_TZ = "jv";
12112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
12131537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Constant for date skeleton with hour and timezone.
12142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @deprecated ICU 50 Use instead {@link #HOUR}+{@link #ABBR_SPECIFIC_TZ} or some other timezone presentation.
121593cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller     * @hide original deprecated declaration
12162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    @Deprecated
12182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final String HOUR_TZ = "jz";
12192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
12222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Gets the time formatter with the default formatting style
12232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the default <code>FORMAT</code> locale.
12242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a time formatter.
12252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see Category#FORMAT
12262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getTimeInstance()
12282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
12292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(-1, DEFAULT, ULocale.getDefault(Category.FORMAT), null);
12302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
12312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
12332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the time formatter with the given formatting style
12342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the default <code>FORMAT</code> locale.
12352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param style the given formatting style. For example,
12362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * SHORT for "h:mm a" in the US locale. Relative time styles are not currently
12372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * supported, and behave just like the corresponding non-relative style.
12382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a time formatter.
12392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see Category#FORMAT
12402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getTimeInstance(int style)
12422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
12432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(-1, style, ULocale.getDefault(Category.FORMAT), null);
12442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
12452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
12472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the time formatter with the given formatting style
12482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the given locale.
12492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param style the given formatting style. For example,
12502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * SHORT for "h:mm a" in the US locale. Relative time styles are not currently
12512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * supported, and behave just like the corresponding non-relative style.
12522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param aLocale the given locale.
12532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a time formatter.
12542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getTimeInstance(int style,
12562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                                 Locale aLocale)
12572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
12582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(-1, style, ULocale.forLocale(aLocale), null);
12592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
12602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
12622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the time formatter with the given formatting style
12632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the given locale.
12642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param style the given formatting style. For example,
12652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * SHORT for "h:mm a" in the US locale. Relative time styles are not currently
12662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * supported, and behave just like the corresponding non-relative style.
12672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale the given ulocale.
12682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a time formatter.
12692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getTimeInstance(int style,
12712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                                 ULocale locale)
12722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
12732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(-1, style, locale, null);
12742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
12752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
12772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the date formatter with the default formatting style
12782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the default <code>FORMAT</code> locale.
12792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a date formatter.
12802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see Category#FORMAT
12812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getDateInstance()
12832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
12842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(DEFAULT, -1, ULocale.getDefault(Category.FORMAT), null);
12852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
12862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
12872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
12882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the date formatter with the given formatting style
12892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the default <code>FORMAT</code> locale.
12902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param style the given formatting style. For example,
12912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
12922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * formatting only affects a limited range of calendar days before or after the
12932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * current date, based on the CLDR &lt;field type="day"&gt;/&lt;relative&gt; data: For example,
12942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
12952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates are formatted using the corresponding non-relative style.
12962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a date formatter.
12972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see Category#FORMAT
12982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
12992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getDateInstance(int style)
13002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
13012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(style, -1, ULocale.getDefault(Category.FORMAT), null);
13022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
13032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
13042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
13052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the date formatter with the given formatting style
13062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the given locale.
13072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param style the given formatting style. For example,
13082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
13092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * formatting only affects a limited range of calendar days before or after the
13102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * current date, based on the CLDR &lt;field type="day"&gt;/&lt;relative&gt; data: For example,
13112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
13122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates are formatted using the corresponding non-relative style.
13132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param aLocale the given locale.
13142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a date formatter.
13152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
13162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getDateInstance(int style,
13172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                                 Locale aLocale)
13182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
13192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(style, -1, ULocale.forLocale(aLocale), null);
13202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
13212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
13222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
13232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the date formatter with the given formatting style
13242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the given locale.
13252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param style the given formatting style. For example,
13262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
13272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * formatting only affects a limited range of calendar days before or after the
13282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * current date, based on the CLDR &lt;field type="day"&gt;/&lt;relative&gt; data: For example,
13292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
13302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates are formatted using the corresponding non-relative style.
13312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale the given ulocale.
13322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a date formatter.
13332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
13342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getDateInstance(int style,
13352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                                 ULocale locale)
13362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
13372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(style, -1, locale, null);
13382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
13392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
13402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
13412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the date/time formatter with the default formatting style
13422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the default <code>FORMAT</code> locale.
13432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a date/time formatter.
13442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see Category#FORMAT
13452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
13462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getDateTimeInstance()
13472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
13482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(DEFAULT, DEFAULT, ULocale.getDefault(Category.FORMAT), null);
13492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
13502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
13512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
13522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the date/time formatter with the given date and time
13532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * formatting styles for the default <code>FORMAT</code> locale.
13542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle the given date formatting style. For example,
13552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
13562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * formatting only affects a limited range of calendar days before or after the
13572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * current date, based on the CLDR &lt;field type="day"&gt;/&lt;relative&gt; data: For example,
13582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
13592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates are formatted using the corresponding non-relative style.
13602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle the given time formatting style. For example,
13612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * SHORT for "h:mm a" in the US locale. Relative time styles are not currently
13622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * supported, and behave just like the corresponding non-relative style.
13632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a date/time formatter.
13642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see Category#FORMAT
13652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
13662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getDateTimeInstance(int dateStyle,
13672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                                       int timeStyle)
13682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
13692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(dateStyle, timeStyle, ULocale.getDefault(Category.FORMAT), null);
13702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
13712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
13722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
13732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the date/time formatter with the given formatting styles
13742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the given locale.
13752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle the given date formatting style. As currently implemented, relative date
13762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * formatting only affects a limited range of calendar days before or after the
13772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * current date, based on the CLDR &lt;field type="day"&gt;/&lt;relative&gt; data: For example,
13782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
13792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates are formatted using the corresponding non-relative style.
13802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle the given time formatting style. Relative time styles are not
13812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * currently supported, and behave just like the corresponding non-relative style.
13822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param aLocale the given locale.
13832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a date/time formatter.
13842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
13852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getDateTimeInstance(
13862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        int dateStyle, int timeStyle, Locale aLocale)
13872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
13882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(dateStyle, timeStyle, ULocale.forLocale(aLocale), null);
13892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
13902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
13912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
13922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the date/time formatter with the given formatting styles
13932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for the given locale.
13942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle the given date formatting style. As currently implemented, relative date
13952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * formatting only affects a limited range of calendar days before or after the
13962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * current date, based on the CLDR &lt;field type="day"&gt;/&lt;relative&gt; data: For example,
13972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
13982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates are formatted using the corresponding non-relative style.
13992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle the given time formatting style. Relative time styles are not
14002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * currently supported, and behave just like the corresponding non-relative style.
14012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale the given ulocale.
14022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return a date/time formatter.
14032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getDateTimeInstance(
14052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        int dateStyle, int timeStyle, ULocale locale)
14062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(dateStyle, timeStyle, locale, null);
14082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns a default date/time formatter that uses the SHORT style for both the
14122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * date and the time.
14132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getInstance() {
14152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(SHORT, SHORT);
14162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the set of locales for which DateFormats are installed.
14202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the set of locales for which DateFormats are installed.
14212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static Locale[] getAvailableLocales()
14232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return ICUResourceBundle.getAvailableLocales();
14252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14281537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Returns the set of locales for which DateFormats are installed.
14292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the set of locales for which DateFormats are installed.
1430836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller     * @hide draft / provisional / internal are hidden on Android
14312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static ULocale[] getAvailableULocales()
14332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return ICUResourceBundle.getAvailableULocales();
14352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Sets the calendar to be used by this date format.  Initially, the default
14392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * calendar for the specified or default locale is used.
14402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param newCalendar the new Calendar to be used by the date format
14412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public void setCalendar(Calendar newCalendar)
14432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        this.calendar = newCalendar;
14452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the calendar associated with this date/time formatter.
14492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the calendar associated with this date/time formatter.
14502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Calendar getCalendar()
14522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return calendar;
14542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Sets the number formatter.
14582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param newNumberFormat the given new NumberFormat.
14592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public void setNumberFormat(NumberFormat newNumberFormat)
14612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        this.numberFormat = newNumberFormat;
14632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /*In order to parse String like "11.10.2001" to DateTime correctly
14642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller          in Locale("fr","CH") [Richard/GCL]
14652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        */
14662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        this.numberFormat.setParseIntegerOnly(true);
14672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the number formatter which this date/time formatter uses to
14712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * format and parse a time.
14722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the number formatter which this date/time formatter uses.
14732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public NumberFormat getNumberFormat()
14752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return numberFormat;
14772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Sets the time zone for the calendar of this DateFormat object.
14812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param zone the given new time zone.
14822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public void setTimeZone(TimeZone zone)
14842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        calendar.setTimeZone(zone);
14862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the time zone.
14902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the time zone associated with the calendar of DateFormat.
14912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
14922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public TimeZone getTimeZone()
14932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
14942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return calendar.getTimeZone();
14952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
14962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
14972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
14982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Specifies whether date/time parsing is to be lenient.  With
14992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * lenient parsing, the parser may use heuristics to interpret inputs that
15002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * do not precisely match this object's format.  Without lenient parsing,
15012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * inputs must match this object's format more closely.
150208ae9f2909b2ec37f755dac4372553437e9d7cf6Paul Duffin     * <br><br>
15031c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * <b>Note:</b> ICU 53 introduced finer grained control of leniency (and added
15041c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * new control points) making the preferred method a combination of
150508ae9f2909b2ec37f755dac4372553437e9d7cf6Paul Duffin     * setCalendarLenient() &amp; setBooleanAttribute() calls.
15061c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * This method supports prior functionality but may not support all
150708ae9f2909b2ec37f755dac4372553437e9d7cf6Paul Duffin     * future leniency control &amp; behavior of DateFormat. For control of pre 53 leniency,
150808ae9f2909b2ec37f755dac4372553437e9d7cf6Paul Duffin     * Calendar and DateFormat whitespace &amp; numeric tolerance, this method is safe to
15091c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * use. However, mixing leniency control via this method and modification of the
15101c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * newer attributes via setBooleanAttribute() may produce undesirable
15112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * results.
15122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
15132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param lenient True specifies date/time interpretation to be lenient.
15142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see android.icu.util.Calendar#setLenient
15152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see #setBooleanAttribute(BooleanAttribute, boolean)
15162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see #setCalendarLenient(boolean)
15172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
15182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public void setLenient(boolean lenient)
15192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
15202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        calendar.setLenient(lenient);
15212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        setBooleanAttribute(BooleanAttribute.PARSE_ALLOW_NUMERIC, lenient);
15222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        setBooleanAttribute(BooleanAttribute.PARSE_ALLOW_WHITESPACE, lenient);
15232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
15242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
15252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
152608ae9f2909b2ec37f755dac4372553437e9d7cf6Paul Duffin     * Returns whether both date/time parsing in the encapsulated Calendar object and DateFormat whitespace &amp;
15272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * numeric processing is lenient.
15282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
15292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public boolean isLenient()
15302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
15311c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        return calendar.isLenient()
15322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                && getBooleanAttribute(BooleanAttribute.PARSE_ALLOW_NUMERIC)
15332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                && getBooleanAttribute(BooleanAttribute.PARSE_ALLOW_WHITESPACE);
15342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
15352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
15361c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    /**
15371c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * Specifies whether date/time parsing in the encapsulated Calendar object should be lenient.
15382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * With lenient parsing, the parser may use heuristics to interpret inputs that
15392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * do not precisely match this object's format.  Without lenient parsing,
15402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * inputs must match this object's format more closely.
15411c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * @param lenient when true, Calendar parsing is lenient
15421c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * @see android.icu.util.Calendar#setLenient
15431c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     */
15442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public void setCalendarLenient(boolean lenient)
15452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
15462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        calendar.setLenient(lenient);
15472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
15482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
15491c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
15501c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    /**
15511c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * Returns whether date/time parsing in the encapsulated Calendar object is lenient.
15521c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     */
15532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public boolean isCalendarLenient()
15542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
15552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return calendar.isLenient();
15562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
15571c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
15581c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    /**
15592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Sets a boolean attribute for this instance. Aspects of DateFormat leniency are controlled by
15601c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * boolean attributes.
15611c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     *
15622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see BooleanAttribute
15632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
15641c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    public DateFormat setBooleanAttribute(BooleanAttribute key, boolean value)
15652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
15662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if(key.equals(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH)) {
15672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            key = DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH;
15682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
15692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if(value)
15702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        {
15712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            booleanAttributes.add(key);
15722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
15732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        else
15742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        {
15752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            booleanAttributes.remove(key);
15762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
15771c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
15782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return this;
15792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
15801c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
15812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
15822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns the current value for the specified BooleanAttribute for this instance
15832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
15842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * if attribute is missing false is returned.
15851c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     *
15862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see BooleanAttribute
15872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
15881c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert    public boolean getBooleanAttribute(BooleanAttribute key)
15892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
15902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if(key == DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH) {
15912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            key = DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH;
15922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
15932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return booleanAttributes.contains(key);
15942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
15951c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
15961c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
15972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
15981537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Set a particular DisplayContext value in the formatter,
15991c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * such as CAPITALIZATION_FOR_STANDALONE.
16001c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     *
16011c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * @param context The DisplayContext value to set.
16022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
16032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public void setContext(DisplayContext context) {
16042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (context.type() == DisplayContext.Type.CAPITALIZATION) {
16052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            capitalizationSetting = context;
16062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
16072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
16082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
16092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
16101537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Get the formatter's DisplayContext value for the specified DisplayContext.Type,
16112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * such as CAPITALIZATION.
16121c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     *
16132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param type the DisplayContext.Type whose value to return
16142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @return the current DisplayContext setting for the specified type
16152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
16162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public DisplayContext getContext(DisplayContext.Type type) {
16172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return (type == DisplayContext.Type.CAPITALIZATION && capitalizationSetting != null)?
16182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                capitalizationSetting: DisplayContext.CAPITALIZATION_NONE;
16192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
16202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
16212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
16222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Overrides hashCode.
16232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
16242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    ///CLOVER:OFF
16252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // turn off code coverage since all subclasses override this
1626f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert    @Override
16272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public int hashCode() {
16282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return numberFormat.hashCode();
16292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // just enough fields for a reasonable distribution
16302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
16312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    ///CLOVER:ON
16322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
16332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
16342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Overrides equals.
16352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1636f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert    @Override
16372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public boolean equals(Object obj) {
16382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (this == obj) return true;
16392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (obj == null || getClass() != obj.getClass()) return false;
16402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        DateFormat other = (DateFormat) obj;
16412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return (((calendar==null && other.calendar==null) ||
16422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    (calendar!=null && other.calendar!=null && calendar.isEquivalentTo(other.calendar))) &&
16432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                ((numberFormat==null && other.numberFormat==null) ||
16442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    (numberFormat!=null && other.numberFormat!=null && numberFormat.equals(other.numberFormat))) &&
16452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                capitalizationSetting == other.capitalizationSetting);
16462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
16472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
16482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
16492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Overrides clone.
16502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
1651f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert    @Override
16522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Object clone()
16532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
16542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        DateFormat other = (DateFormat) super.clone();
16552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        other.calendar = (Calendar) calendar.clone();
16562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (numberFormat != null) {
16572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            other.numberFormat = (NumberFormat) numberFormat.clone();
16582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
16592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return other;
16602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
16612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
16622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
16632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a DateFormat with the given time and/or date style in the given
16642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * locale.
16652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle a value from 0 to 3 indicating the time format,
16662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * or -1 to indicate no date
16672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle a value from 0 to 3 indicating the time format,
16682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * or -1 to indicate no time
16692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param loc the locale for the format
16702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal the calendar to be used, or null
16712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
16722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private static DateFormat get(int dateStyle, int timeStyle, ULocale loc, Calendar cal) {
16732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if((timeStyle != DateFormat.NONE && (timeStyle & RELATIVE)>0) ||
16742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller           (dateStyle != DateFormat.NONE && (dateStyle & RELATIVE)>0)) {
16752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            RelativeDateFormat r = new RelativeDateFormat(timeStyle, dateStyle /* offset? */, loc, cal);
16762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return r;
16772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
16782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
16792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (timeStyle < DateFormat.NONE || timeStyle > DateFormat.SHORT) {
16802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            throw new IllegalArgumentException("Illegal time style " + timeStyle);
16812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
16822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (dateStyle < DateFormat.NONE || dateStyle > DateFormat.SHORT) {
16832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            throw new IllegalArgumentException("Illegal date style " + dateStyle);
16842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
16852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
16862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (cal == null) {
16872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            cal = Calendar.getInstance(loc);
16882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
16892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
16902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        try {
16912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            DateFormat result = cal.getDateTimeFormat(dateStyle, timeStyle, loc);
16922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            result.setLocale(cal.getLocale(ULocale.VALID_LOCALE),
16932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                 cal.getLocale(ULocale.ACTUAL_LOCALE));
16942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return result;
16952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        } catch (MissingResourceException e) {
16962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ///CLOVER:OFF
16972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            // coverage requires separate run with no data, so skip
16982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return new SimpleDateFormat("M/d/yy h:mm a");
16992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ///CLOVER:ON
17002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
17012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
17022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
17042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * First, read in the default serializable data.
17052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Then, if <code>serialVersionOnStream</code> is less than 1, indicating that
17072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the stream was written by a pre-ICU-53 version,
17082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * set capitalizationSetting to a default value.
17092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Finally, set serialVersionOnStream back to the maximum allowed value so that
17102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * default serialization will work properly if this object is streamed out again.
17112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
17122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private void readObject(ObjectInputStream stream)
17132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         throws IOException, ClassNotFoundException
17142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
17152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        stream.defaultReadObject();
17162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (serialVersionOnStream < 1) {
17172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            // Didn't have capitalizationSetting, set it to default
17182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            capitalizationSetting = DisplayContext.CAPITALIZATION_NONE;
17192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
17201c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
17212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // if deserialized from a release that didn't have booleanAttributes, add them all
17222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if(booleanAttributes == null) {
17232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            booleanAttributes = EnumSet.allOf(BooleanAttribute.class);
17242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
17252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        serialVersionOnStream = currentSerialVersion;
17272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
17282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
17302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a new date format.
17312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
17322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    protected DateFormat() {}
17332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    //-------------------------------------------------------------------------
17372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // Public static interface for creating custon DateFormats for different
17382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    // types of Calendars.
17392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    //-------------------------------------------------------------------------
17402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
17422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object that can be used to format dates in
17432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the calendar system specified by <code>cal</code>.
17442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p>
17452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date format is desired.
17462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle The type of date format desired.  This can be
17482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
17492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
17502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date format is desired.
17522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
17532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getDateInstance(Calendar cal, int dateStyle, Locale locale)
17542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
17552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(cal, dateStyle, -1, ULocale.forLocale(locale));
17562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
17572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
17592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object that can be used to format dates in
17602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the calendar system specified by <code>cal</code>.
17612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p>
17622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date format is desired.
17632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle The type of date format desired.  This can be
17652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
17662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
17672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date format is desired.
17692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
17702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getDateInstance(Calendar cal, int dateStyle, ULocale locale)
17712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
17722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(cal, dateStyle, -1, locale);
17732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
17742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
17762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object that can be used to format times in
17772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the calendar system specified by <code>cal</code>.
17782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a time format is desired.
17792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle The type of time format desired.  This can be
17812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
17822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
17832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the time format is desired.
17852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see DateFormat#getTimeInstance
17872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
17882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getTimeInstance(Calendar cal, int timeStyle, Locale locale)
17892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
17902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(cal, -1, timeStyle, ULocale.forLocale(locale));
17912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
17922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
17932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
17942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object that can be used to format times in
17952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the calendar system specified by <code>cal</code>.
17962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a time format is desired.
17972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
17982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle The type of time format desired.  This can be
17992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
18002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
18012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the time format is desired.
18032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see DateFormat#getTimeInstance
18052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
18062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getTimeInstance(Calendar cal, int timeStyle, ULocale locale)
18072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
18082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(cal, -1, timeStyle, locale);
18092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
18102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
18112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
18122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object that can be used to format dates and times in
18132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the calendar system specified by <code>cal</code>.
18142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
18152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle The type of date format desired.  This can be
18172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
18182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
18192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle The type of time format desired.  This can be
18212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
18222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
18232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
18252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see DateFormat#getDateTimeInstance
18272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
18282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle,
18292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                                 int timeStyle, Locale locale)
18302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
18312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(dateStyle, timeStyle, ULocale.forLocale(locale));
18322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
18332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
18342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
18352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object that can be used to format dates and times in
18362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the calendar system specified by <code>cal</code>.
18372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
18382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle The type of date format desired.  This can be
18402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
18412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
18422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle The type of time format desired.  This can be
18442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
18452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
18462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
18482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see DateFormat#getDateTimeInstance
18502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
18512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle,
18522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                                 int timeStyle, ULocale locale)
18532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    {
18542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (cal == null) {
18552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            throw new IllegalArgumentException("Calendar must be supplied");
18562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
18572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return get(dateStyle, timeStyle, locale, cal);
18582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
18592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
18602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
18612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns a date/time formatter that uses the SHORT style
18622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for both the date and the time.
18631c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     *
18642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
18651c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * @param locale The locale for which the date/time format is desired.
18662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
18672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getInstance(Calendar cal, Locale locale) {
18682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(cal, SHORT, SHORT, ULocale.forLocale(locale));
18692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
18702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
18712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
18722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns a date/time formatter that uses the SHORT style
18732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * for both the date and the time.
18741c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     *
18752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
18761c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     * @param locale The locale for which the date/time format is desired.
1877836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller     * @hide draft / provisional / internal are hidden on Android
18782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
18792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getInstance(Calendar cal, ULocale locale) {
18802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(cal, SHORT, SHORT, locale);
18812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
18822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
18832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
18842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Returns a default date/time formatter that uses the SHORT style for both the
18852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * date and the time.
18861c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert     *
18872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
18882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
18892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getInstance(Calendar cal) {
18902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getInstance(cal, ULocale.getDefault(Category.FORMAT));
18912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
18922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
18932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
18942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object for the default locale that can be used
18952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * to format dates in the calendar system specified by <code>cal</code>.
18962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p>
18972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date format is desired.
18982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
18992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle The type of date format desired.  This can be
19002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
19012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
19022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
19032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getDateInstance(Calendar cal, int dateStyle) {
19042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateInstance(cal, dateStyle, ULocale.getDefault(Category.FORMAT));
19052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
19062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
19072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
19082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object that can be used to format times in
19092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the calendar system specified by <code>cal</code>.
19102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a time format is desired.
19112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle The type of time format desired.  This can be
19132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
19142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
19152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see DateFormat#getTimeInstance
19172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
19182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getTimeInstance(Calendar cal, int timeStyle) {
19192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getTimeInstance(cal, timeStyle, ULocale.getDefault(Category.FORMAT));
19202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
19212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
19222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
19232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Creates a {@link DateFormat} object for the default locale that can be used to format
19242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * dates and times in the calendar system specified by <code>cal</code>.
19252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
19262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param dateStyle The type of date format desired.  This can be
19282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
19292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
19302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param timeStyle The type of time format desired.  This can be
19322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
19332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
19342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @see DateFormat#getDateTimeInstance
19362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
19372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle, int timeStyle) {
19382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getDateTimeInstance(cal, dateStyle, timeStyle, ULocale.getDefault(Category.FORMAT));
19392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
19401c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
19412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
19421537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
19432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the default locale.
19442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
19462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
19472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
19482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
19492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getInstanceForSkeleton(String skeleton) {
19502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getPatternInstance(skeleton, ULocale.getDefault(Category.FORMAT));
19512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
19522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
19532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
19541537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
19552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the given locale.
19562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
19582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
19592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
19602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
19622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
19632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getInstanceForSkeleton(String skeleton, Locale locale) {
19642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getPatternInstance(skeleton, ULocale.forLocale(locale));
19652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
19662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
19672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
19681537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
19692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the given locale.
19702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
19722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
19732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
19742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
19762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
19772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getInstanceForSkeleton(String skeleton, ULocale locale) {
19782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale);
19792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        final String bestPattern = generator.getBestPattern(skeleton);
19802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return new SimpleDateFormat(bestPattern, locale);
19812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
19822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
19832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
19841537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Creates a {@link DateFormat} object that can be used to format dates and
19852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * times in the calendar system specified by <code>cal</code>.
19862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
19882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
19902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.)  This can be
19912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#ABBR_MONTH}, {@link DateFormat#MONTH_WEEKDAY_DAY},
19922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
19932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
19942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
19952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
19962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getInstanceForSkeleton(Calendar cal, String skeleton, Locale locale) {
19972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getPatternInstance(cal, skeleton, ULocale.forLocale(locale));
19982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
19992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
20002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
20011537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Creates a {@link DateFormat} object that can be used to format dates and
20022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * times in the calendar system specified by <code>cal</code>.
20032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
20052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
20072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.)  This can be
20082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#ABBR_MONTH}, {@link DateFormat#MONTH_WEEKDAY_DAY},
20092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
20102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
20122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
20132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getInstanceForSkeleton(
20142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Calendar cal, String skeleton, ULocale locale) {
20152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale);
20162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        final String bestPattern = generator.getBestPattern(skeleton);
20172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        SimpleDateFormat format = new SimpleDateFormat(bestPattern, locale);
20182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        format.setCalendar(cal);
20192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return format;
20202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
20212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
20222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
20232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
20241537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
20252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the default locale.
20262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * The getInstanceForSkeleton methods are preferred over the getPatternInstance methods.
20272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
20292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
20302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
20312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
20322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getPatternInstance(String skeleton) {
20332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getInstanceForSkeleton(skeleton);
20342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
20352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
20362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
20371537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
20382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the given locale.
20392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * The getInstanceForSkeleton methods are preferred over the getPatternInstance methods.
20402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
20422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
20432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
20442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
20462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
20472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getPatternInstance(String skeleton, Locale locale) {
20482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getInstanceForSkeleton(skeleton, locale);
20492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
20502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
20512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
20521537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
20532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * the given locale.
20542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * The getInstanceForSkeleton methods are preferred over the getPatternInstance methods.
20552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
20572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
20582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
20592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
20612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
20622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getPatternInstance(String skeleton, ULocale locale) {
20632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getInstanceForSkeleton(skeleton, locale);
20642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
20652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
20662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
20671537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Creates a {@link DateFormat} object that can be used to format dates and
20682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * times in the calendar system specified by <code>cal</code>.
20692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * The getInstanceForSkeleton methods are preferred over the getPatternInstance methods.
20702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
20722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
20742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.)  This can be
20752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#ABBR_MONTH}, {@link DateFormat#MONTH_WEEKDAY_DAY},
20762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
20772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
20792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
20802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getPatternInstance(Calendar cal, String skeleton, Locale locale) {
20812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getInstanceForSkeleton(cal, skeleton, locale);
20822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
20832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
20842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
20851537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller     * <strong>[icu]</strong> Creates a {@link DateFormat} object that can be used to format dates and
20862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * times in the calendar system specified by <code>cal</code>.
20872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * The getInstanceForSkeleton methods are preferred over the getPatternInstance methods.
20882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param cal   The calendar system for which a date/time format is desired.
20902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param skeleton The skeleton that selects the fields to be formatted. (Uses the
20922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateTimePatternGenerator}.)  This can be
20932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              {@link DateFormat#ABBR_MONTH}, {@link DateFormat#MONTH_WEEKDAY_DAY},
20942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *              etc.
20952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
20962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * @param locale The locale for which the date/time format is desired.
20972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
20982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public final static DateFormat getPatternInstance(
20992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Calendar cal, String skeleton, ULocale locale) {
21002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return getInstanceForSkeleton(cal, skeleton, locale);
21012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
21022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /**
21042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * The instances of this inner class are used as attribute keys and values
21052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * in AttributedCharacterIterator that
21062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * DateFormat.formatToCharacterIterator() method returns.
21072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     *
21082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p>There is no public constructor to this class, the only instances are the
21092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * constants defined here.
21102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * <p>
21112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
21122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static class Field extends Format.Field {
21132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        private static final long serialVersionUID = -3627456821000730829L;
21152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Max number of calendar fields
21172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        private static final int CAL_FIELD_COUNT;
21182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Table for mapping calendar field number to DateFormat.Field
21202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        private static final Field[] CAL_FIELDS;
21212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Map for resolving DateFormat.Field by name
21232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        private static final Map<String, Field> FIELD_NAME_MAP;
21242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        static {
21262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            GregorianCalendar cal = new GregorianCalendar();
21272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            CAL_FIELD_COUNT = cal.getFieldCount();
21282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            CAL_FIELDS = new Field[CAL_FIELD_COUNT];
21292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            FIELD_NAME_MAP = new HashMap<String, Field>(CAL_FIELD_COUNT);
21302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
21312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Java fields -------------------
21332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the time of day indicator(am/pm).
21362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field AM_PM = new Field("am pm", Calendar.AM_PM);
21382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the day of month field.
21412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field DAY_OF_MONTH = new Field("day of month", Calendar.DAY_OF_MONTH);
21432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the day of week field.
21462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field DAY_OF_WEEK = new Field("day of week", Calendar.DAY_OF_WEEK);
21482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the day of week in month field.
21512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field DAY_OF_WEEK_IN_MONTH =
21532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            new Field("day of week in month", Calendar.DAY_OF_WEEK_IN_MONTH);
21542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the day of year field.
21572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field DAY_OF_YEAR = new Field("day of year", Calendar.DAY_OF_YEAR);
21592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the era field.
21622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field ERA = new Field("era", Calendar.ERA);
21642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the hour(0-23) of day field.
21672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field HOUR_OF_DAY0 = new Field("hour of day", Calendar.HOUR_OF_DAY);
21692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the hour(1-24) of day field.
21722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field HOUR_OF_DAY1 = new Field("hour of day 1", -1);
21742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the hour(0-11) field.
21772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field HOUR0 = new Field("hour", Calendar.HOUR);
21792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the hour(1-12) field.
21822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field HOUR1 = new Field("hour 1", -1);
21842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the millisecond field.
21872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field MILLISECOND = new Field("millisecond", Calendar.MILLISECOND);
21892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the minute field.
21922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field MINUTE = new Field("minute", Calendar.MINUTE);
21942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
21952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
21962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the month field.
21972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
21982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field MONTH = new Field("month", Calendar.MONTH);
21992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the second field.
22022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field SECOND = new Field("second", Calendar.SECOND);
22042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the time zone field.
22072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field TIME_ZONE = new Field("time zone", -1);
22092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the week of month field.
22122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field WEEK_OF_MONTH =
22142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            new Field("week of month", Calendar.WEEK_OF_MONTH);
22152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the week of year field.
22182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field WEEK_OF_YEAR = new Field("week of year", Calendar.WEEK_OF_YEAR);
22202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the year field.
22232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field YEAR = new Field("year", Calendar.YEAR);
22252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // ICU only fields -------------------
22282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the local day of week field.
22312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field DOW_LOCAL = new Field("local day of week", Calendar.DOW_LOCAL);
22332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the extended year field.
22362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22371c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        public static final Field EXTENDED_YEAR = new Field("extended year",
22382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                                                            Calendar.EXTENDED_YEAR);
22392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the Julian day field.
22422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field JULIAN_DAY = new Field("Julian day", Calendar.JULIAN_DAY);
22442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the milliseconds in day field.
22472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field MILLISECONDS_IN_DAY =
22492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            new Field("milliseconds in day", Calendar.MILLISECONDS_IN_DAY);
22502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the year used with week of year field.
22532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field YEAR_WOY = new Field("year for week of year", Calendar.YEAR_WOY);
22552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the quarter field.
22582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field QUARTER = new Field("quarter", -1);
22602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the related year field.
22632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @deprecated This API is ICU internal only.
2264836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller         * @hide draft / provisional / internal are hidden on Android
22652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        @Deprecated
22672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field RELATED_YEAR = new Field("related year", -1);
22682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
22701c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * <strong>[icu]</strong> Constant identifying the am/pm/midnight/noon field.
22711c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * @hide draft / provisional / internal are hidden on Android
22721c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         */
22731c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        public static final Field AM_PM_MIDNIGHT_NOON = new Field("am/pm/midnight/noon", -1);
22741c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
22751c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        /**
22761c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * <strong>[icu]</strong> Constant identifying the flexible day period field.
22771c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * @hide draft / provisional / internal are hidden on Android
22781c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         */
22791c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        public static final Field FLEXIBLE_DAY_PERIOD = new Field("flexible day period", -1);
22801c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert
22811c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        /**
22822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constant identifying the time separator field.
22831c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert         * @deprecated This API is ICU internal only.
2284836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller         * @hide draft / provisional / internal are hidden on Android
22852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
22861c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert        @Deprecated
22872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field TIME_SEPARATOR = new Field("time separator", -1);
22882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Stand alone types are variants for its base types.  So we do not define Field for
22902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // them.
22912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /*
22922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field STANDALONE_DAY =
22932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            new Field("stand alone day of week", Calendar.DAY_OF_WEEK);
22942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field STANDALONE_MONTH = new Field("stand alone month", Calendar.MONTH);
22952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static final Field STANDALONE_QUARTER = new Field("stand alone quarter", -1);
22962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        */
22972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
22982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Corresponding calendar field
22992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        private final int calendarField;
23002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
23012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
23022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Constructs a <code>DateFormat.Field</code> with the given name and
23032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * the <code>Calendar</code> field which this attribute represents.  Use -1 for
23042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * <code>calendarField</code> if this field does not have a corresponding
23052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * <code>Calendar</code> field.
23062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         *
23072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @param name          Name of the attribute
23082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @param calendarField <code>Calendar</code> field constant
23092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
23102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        protected Field(String name, int calendarField) {
23112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            super(name);
23122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            this.calendarField = calendarField;
23132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            if (this.getClass() == DateFormat.Field.class) {
23142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                FIELD_NAME_MAP.put(name, this);
23152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                if (calendarField >= 0 && calendarField < CAL_FIELD_COUNT) {
23162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    CAL_FIELDS[calendarField] = this;
23172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                }
23182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
23192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
23202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
23212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
23222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Returns the <code>Field</code> constant that corresponds to the <code>
23232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Calendar</code> field <code>calendarField</code>.  If there is no
23242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * corresponding <code>Field</code> is available, null is returned.
23252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         *
23262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @param calendarField <code>Calendar</code> field constant
23272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @return <code>Field</code> associated with the <code>calendarField</code>,
23282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * or null if no associated <code>Field</code> is available.
23292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @throws IllegalArgumentException if <code>calendarField</code> is not
23302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * a valid <code>Calendar</code> field constant.
23312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
23322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public static DateFormat.Field ofCalendarField(int calendarField) {
23332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            if (calendarField < 0 || calendarField >= CAL_FIELD_COUNT) {
23342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                throw new IllegalArgumentException("Calendar field number is out of range");
23352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
23362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return CAL_FIELDS[calendarField];
23372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
23382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
23392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
23402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Returns the <code>Calendar</code> field associated with this attribute.
23412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * If there is no corresponding <code>Calendar</code> available, this will
23422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * return -1.
23432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         *
23442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @return <code>Calendar</code> constant for this attribute.
23452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
23462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        public int getCalendarField() {
23472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return calendarField;
23482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
23492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
23502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        /**
23512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * Resolves instances being deserialized to the predefined constants.
23522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         *
23532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         * @throws InvalidObjectException if the constant could not be resolved.
23542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller         */
2355f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert        @Override
23562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        protected Object readResolve() throws InvalidObjectException {
23572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ///CLOVER:OFF
23582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            if (this.getClass() != DateFormat.Field.class) {
23592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                throw new InvalidObjectException(
23602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    "A subclass of DateFormat.Field must implement readResolve.");
23612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
23622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ///CLOVER:ON
23632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            Object o = FIELD_NAME_MAP.get(this.getName());
23642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ///CLOVER:OFF
23652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            if (o == null) {
23662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                throw new InvalidObjectException("Unknown attribute name.");
23672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
23682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            ///CLOVER:ON
23692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return o;
23702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
23712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
23722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller}
2373