xref: /aosp_15_r20/external/cldr/docs/ldml/tr35-dates.md (revision 912701f9769bb47905792267661f0baf2b85bed5)
1*912701f9SAndroid Build Coastguard Worker## Unicode Technical Standard #35
2*912701f9SAndroid Build Coastguard Worker
3*912701f9SAndroid Build Coastguard Worker# Unicode Locale Data Markup Language (LDML)<br/>Part 4: Dates
4*912701f9SAndroid Build Coastguard Worker
5*912701f9SAndroid Build Coastguard Worker|Version|45                |
6*912701f9SAndroid Build Coastguard Worker|-------|------------------|
7*912701f9SAndroid Build Coastguard Worker|Editors|Peter Edberg and <a href="tr35.md#Acknowledgments">other CLDR committee members</a>|
8*912701f9SAndroid Build Coastguard Worker
9*912701f9SAndroid Build Coastguard WorkerFor the full header, summary, and status, see [Part 1: Core](tr35.md).
10*912701f9SAndroid Build Coastguard Worker
11*912701f9SAndroid Build Coastguard Worker### _Summary_
12*912701f9SAndroid Build Coastguard Worker
13*912701f9SAndroid Build Coastguard WorkerThis document describes parts of an XML format (_vocabulary_) for the exchange of structured locale data. This format is used in the [Unicode Common Locale Data Repository](https://www.unicode.org/cldr/).
14*912701f9SAndroid Build Coastguard Worker
15*912701f9SAndroid Build Coastguard WorkerThis is a partial document, describing only those parts of the LDML that are relevant for date, time, and time zone formatting. For the other parts of the LDML see the [main LDML document](tr35.md) and the links above.
16*912701f9SAndroid Build Coastguard Worker
17*912701f9SAndroid Build Coastguard Worker### _Status_
18*912701f9SAndroid Build Coastguard Worker
19*912701f9SAndroid Build Coastguard Worker<!-- _This is a draft document which may be updated, replaced, or superseded by other documents at any time.
20*912701f9SAndroid Build Coastguard WorkerPublication does not imply endorsement by the Unicode Consortium.
21*912701f9SAndroid Build Coastguard WorkerThis is not a stable document; it is inappropriate to cite this document as other than a work in progress._ -->
22*912701f9SAndroid Build Coastguard Worker
23*912701f9SAndroid Build Coastguard Worker_This document has been reviewed by Unicode members and other interested parties, and has been approved for publication by the Unicode Consortium.
24*912701f9SAndroid Build Coastguard WorkerThis is a stable document and may be used as reference material or cited as a normative reference by other specifications._
25*912701f9SAndroid Build Coastguard Worker
26*912701f9SAndroid Build Coastguard Worker> _**A Unicode Technical Standard (UTS)** is an independent specification. Conformance to the Unicode Standard does not imply conformance to any UTS._
27*912701f9SAndroid Build Coastguard Worker
28*912701f9SAndroid Build Coastguard Worker_Please submit corrigenda and other comments with the CLDR bug reporting form [[Bugs](tr35.md#Bugs)]. Related information that is useful in understanding this document is found in the [References](tr35.md#References). For the latest version of the Unicode Standard see [[Unicode](tr35.md#Unicode)]. For a list of current Unicode Technical Reports see [[Reports](tr35.md#Reports)]. For more information about versions of the Unicode Standard, see [[Versions](tr35.md#Versions)]._
29*912701f9SAndroid Build Coastguard Worker
30*912701f9SAndroid Build Coastguard Worker## <a name="Parts" href="#Parts">Parts</a>
31*912701f9SAndroid Build Coastguard Worker
32*912701f9SAndroid Build Coastguard WorkerThe LDML specification is divided into the following parts:
33*912701f9SAndroid Build Coastguard Worker
34*912701f9SAndroid Build Coastguard Worker*   Part 1: [Core](tr35.md#Contents) (languages, locales, basic structure)
35*912701f9SAndroid Build Coastguard Worker*   Part 2: [General](tr35-general.md#Contents) (display names & transforms, etc.)
36*912701f9SAndroid Build Coastguard Worker*   Part 3: [Numbers](tr35-numbers.md#Contents) (number & currency formatting)
37*912701f9SAndroid Build Coastguard Worker*   Part 4: [Dates](tr35-dates.md#Contents) (date, time, time zone formatting)
38*912701f9SAndroid Build Coastguard Worker*   Part 5: [Collation](tr35-collation.md#Contents) (sorting, searching, grouping)
39*912701f9SAndroid Build Coastguard Worker*   Part 6: [Supplemental](tr35-info.md#Contents) (supplemental data)
40*912701f9SAndroid Build Coastguard Worker*   Part 7: [Keyboards](tr35-keyboards.md#Contents) (keyboard mappings)
41*912701f9SAndroid Build Coastguard Worker*   Part 8: [Person Names](tr35-personNames.md#Contents) (person names)
42*912701f9SAndroid Build Coastguard Worker*   Part 9: [MessageFormat](tr35-messageFormat.md#Contents) (message format)
43*912701f9SAndroid Build Coastguard Worker
44*912701f9SAndroid Build Coastguard Worker## <a name="Contents" href="#Contents">Contents of Part 4, Dates</a>
45*912701f9SAndroid Build Coastguard Worker
46*912701f9SAndroid Build Coastguard Worker* [Overview: Dates Element, Supplemental Date and Calendar Information](#Overview_Dates_Element_Supplemental)
47*912701f9SAndroid Build Coastguard Worker* [Calendar Elements](#Calendar_Elements)
48*912701f9SAndroid Build Coastguard Worker  * [Elements months, days, quarters, eras](#months_days_quarters_eras)
49*912701f9SAndroid Build Coastguard Worker  * [Elements monthPatterns, cyclicNameSets](#monthPatterns_cyclicNameSets)
50*912701f9SAndroid Build Coastguard Worker  * [Element dayPeriods](#dayPeriods)
51*912701f9SAndroid Build Coastguard Worker  * [Element dateFormats](#dateFormats)
52*912701f9SAndroid Build Coastguard Worker  * [Element timeFormats](#timeFormats)
53*912701f9SAndroid Build Coastguard Worker  * [Element dateTimeFormats](#dateTimeFormats)
54*912701f9SAndroid Build Coastguard Worker    * [Element dateTimeFormat](#dateTimeFormat)
55*912701f9SAndroid Build Coastguard Worker      * Table: [Date-Time Combination Examples](#Date_Time_Combination_Examples)
56*912701f9SAndroid Build Coastguard Worker    * [Elements availableFormats, appendItems](#availableFormats_appendItems)
57*912701f9SAndroid Build Coastguard Worker      * Table: [Mapping Requested Time Skeletons To Patterns](#Mapping_Requested_Time_Skeletons_To_Patterns)
58*912701f9SAndroid Build Coastguard Worker      * [Matching Skeletons](#Matching_Skeletons)
59*912701f9SAndroid Build Coastguard Worker      * [Missing Skeleton Fields](#Missing_Skeleton_Fields)
60*912701f9SAndroid Build Coastguard Worker    * [Element intervalFormats](#intervalFormats)
61*912701f9SAndroid Build Coastguard Worker* [Calendar Fields](#Calendar_Fields)
62*912701f9SAndroid Build Coastguard Worker* [Supplemental Calendar Data](#Supplemental_Calendar_Data)
63*912701f9SAndroid Build Coastguard Worker  * [Calendar Data](#Calendar_Data)
64*912701f9SAndroid Build Coastguard Worker  * [Calendar Preference Data](#Calendar_Preference_Data)
65*912701f9SAndroid Build Coastguard Worker  * [Week Data](#Week_Data)
66*912701f9SAndroid Build Coastguard Worker    * Table: [Week Designation Types](#Week_Designation_Types)
67*912701f9SAndroid Build Coastguard Worker    * [First Day Overrides](#first-day-overrides)
68*912701f9SAndroid Build Coastguard Worker  * [Time Data](#Time_Data)
69*912701f9SAndroid Build Coastguard Worker  * [Day Period Rule Sets](#Day_Period_Rule_Sets)
70*912701f9SAndroid Build Coastguard Worker    * [Day Period Rules](#Day_Period_Rules)
71*912701f9SAndroid Build Coastguard Worker      * [Fixed periods](#Fixed_periods)
72*912701f9SAndroid Build Coastguard Worker      * [Variable periods](#Variable_periods)
73*912701f9SAndroid Build Coastguard Worker      * [Parsing Day Periods](#Parsing_Day_Periods)
74*912701f9SAndroid Build Coastguard Worker* [Time Zone Names](#Time_Zone_Names)
75*912701f9SAndroid Build Coastguard Worker  * Table: [timeZoneNames Elements Used for Fallback](#timeZoneNames_Elements_Used_for_Fallback)
76*912701f9SAndroid Build Coastguard Worker  * [Metazone Names](#Metazone_Names)
77*912701f9SAndroid Build Coastguard Worker* [Supplemental Time Zone Data](#Supplemental_Time_Zone_Data)
78*912701f9SAndroid Build Coastguard Worker  * [Metazones](#Metazones)
79*912701f9SAndroid Build Coastguard Worker  * [Windows Zones](#Windows_Zones)
80*912701f9SAndroid Build Coastguard Worker  * [Primary Zones](#Primary_Zones)
81*912701f9SAndroid Build Coastguard Worker* [Using Time Zone Names](#Using_Time_Zone_Names)
82*912701f9SAndroid Build Coastguard Worker  * [Time Zone Format Terminology](#Time_Zone_Format_Terminology)
83*912701f9SAndroid Build Coastguard Worker  * [Goals](#Time_Zone_Goals)
84*912701f9SAndroid Build Coastguard Worker  * [Parsing](#Time_Zone_Parsing)
85*912701f9SAndroid Build Coastguard Worker* [Date Format Patterns](#Date_Format_Patterns)
86*912701f9SAndroid Build Coastguard Worker  * Table: [Date Format Pattern Examples](#Date_Format_Pattern_Examples)
87*912701f9SAndroid Build Coastguard Worker  * Table: [Date Field Symbol Table](#Date_Field_Symbol_Table)
88*912701f9SAndroid Build Coastguard Worker  * [Localized Pattern Characters (deprecated)](#Localized_Pattern_Characters)
89*912701f9SAndroid Build Coastguard Worker  * [AM / PM](#Date_Patterns_AM_PM)
90*912701f9SAndroid Build Coastguard Worker  * [Eras](#Date_Patterns_Eras)
91*912701f9SAndroid Build Coastguard Worker  * [Week of Year](#Date_Patterns_Week_Of_Year)
92*912701f9SAndroid Build Coastguard Worker  * [Week Elements](#Date_Patterns_Week_Elements)
93*912701f9SAndroid Build Coastguard Worker* [Parsing Dates and Times](#Parsing_Dates_Times)
94*912701f9SAndroid Build Coastguard Worker
95*912701f9SAndroid Build Coastguard Worker## <a name="Overview_Dates_Element_Supplemental" href="#Overview_Dates_Element_Supplemental">Overview: Dates Element, Supplemental Date and Calendar Information</a>
96*912701f9SAndroid Build Coastguard Worker
97*912701f9SAndroid Build Coastguard Worker```xml
98*912701f9SAndroid Build Coastguard Worker<!ELEMENT dates (alias | (calendars?, fields?, timeZoneNames?, special*)) >
99*912701f9SAndroid Build Coastguard Worker```
100*912701f9SAndroid Build Coastguard Worker
101*912701f9SAndroid Build Coastguard WorkerThe LDML top-level `<dates>` element contains information regarding the format and parsing of dates and times, the formatting of date/time intervals, and the naming of various calendar elements.
102*912701f9SAndroid Build Coastguard Worker
103*912701f9SAndroid Build Coastguard Worker*   The `<calendars>` element is described in [Calendar Elements](#Calendar_Elements).
104*912701f9SAndroid Build Coastguard Worker*   The `<fields>` element is described in [Calendar Fields](#Calendar_Fields).
105*912701f9SAndroid Build Coastguard Worker*   The `<timeZoneNames>` element is described in [Time Zone Names](#Time_Zone_Names).
106*912701f9SAndroid Build Coastguard Worker*   The formats use pattern characters described in [Date Format Patterns](#Date_Format_Patterns).
107*912701f9SAndroid Build Coastguard Worker
108*912701f9SAndroid Build Coastguard Worker```xml
109*912701f9SAndroid Build Coastguard Worker<!ELEMENT supplementalData ( …, calendarData?, calendarPreferenceData?, weekData?, timeData?, …, timezoneData?, …, metazoneInfo?, …, dayPeriodRuleSet*, metaZones?, primaryZones?, windowsZones?, …) >
110*912701f9SAndroid Build Coastguard Worker```
111*912701f9SAndroid Build Coastguard Worker
112*912701f9SAndroid Build Coastguard WorkerThe relevant top-level supplemental elements are listed above.
113*912701f9SAndroid Build Coastguard Worker
114*912701f9SAndroid Build Coastguard Worker*   The `<calendarData>`, `<calendarPreferenceData>`, `<weekData>`, `<timeData>`, and `<dayPeriodRuleSet>` elements are described in [Supplemental Calendar Data](#Supplemental_Calendar_Data).
115*912701f9SAndroid Build Coastguard Worker*   The `<timezoneData>` element is deprecated and no longer used; the `<metazoneInfo>` element is deprecated at this level, and is now only used as a sub-element of `<metaZones>`.
116*912701f9SAndroid Build Coastguard Worker*   The `<metaZones>`, `<primaryZones>`, and `<windowsZones>` elements are described in [Supplemental Time Zone Data](#Supplemental_Time_Zone_Data).
117*912701f9SAndroid Build Coastguard Worker
118*912701f9SAndroid Build Coastguard Worker## <a name="Calendar_Elements" href="#Calendar_Elements">Calendar Elements</a>
119*912701f9SAndroid Build Coastguard Worker
120*912701f9SAndroid Build Coastguard Worker```xml
121*912701f9SAndroid Build Coastguard Worker<!ELEMENT calendars (alias | (calendar*, special*)) >
122*912701f9SAndroid Build Coastguard Worker<!ELEMENT calendar (alias | (months?, monthPatterns?, days?, quarters?, dayPeriods?, eras?, cyclicNameSets?, dateFormats?, timeFormats?, dateTimeFormats?, special*))>
123*912701f9SAndroid Build Coastguard Worker<!ATTLIST calendar type NMTOKEN #REQUIRED >
124*912701f9SAndroid Build Coastguard Worker```
125*912701f9SAndroid Build Coastguard Worker
126*912701f9SAndroid Build Coastguard WorkerThe `<calendars>` element contains multiple `<calendar>` elements, each of which specifies the fields used for formatting and parsing dates and times according to the calendar specified by the `type` attribute (e.g. "gregorian", "buddhist", "islamic"). The behaviors for different calendars in a locale may share certain aspects, such as the names for weekdays. They differ in other respects; for example, the Japanese calendar is similar to the Gregorian calendar but has many more eras (one for each Emperor), and years are numbered within each era. All calendar data inherits either from the Gregorian calendar or other calendars in the same locale (and if not present there then from the parent up to root), or else inherits directly from the parent locale for certain calendars, so only data that differs from what would be inherited needs to be supplied. See _[Multiple Inheritance](tr35.md#Multiple_Inheritance)_.
127*912701f9SAndroid Build Coastguard Worker
128*912701f9SAndroid Build Coastguard WorkerEach calendar provides—directly or indirectly—two general types of data:
129*912701f9SAndroid Build Coastguard Worker
130*912701f9SAndroid Build Coastguard Worker*   _Calendar symbols, such as names for eras, months, weekdays, and dayPeriods._ Names for weekdays, quarters and dayPeriods are typically inherited from the Gregorian calendar data in the same locale. Symbols for eras and months should be provided for each calendar, except that the "Gregorian-like" Buddhist, Japanese, and Minguo (ROC) calendars also inherit their month names from the Gregorian data in the same locale.
131*912701f9SAndroid Build Coastguard Worker*   _Format data for dates, times, and date-time intervals._ Non-Gregorian calendars inherit standard time formats (in the `<timeFormats>` element) from the Gregorian calendar in the same locale. Most non-Gregorian calendars (other than Chinese and Dangi) inherit general date format data (in the `<dateFormats>` and `<dateTimeFormats>` elements) from the "generic" calendar format data in the same locale, which in turn inherits from Gregorian.
132*912701f9SAndroid Build Coastguard Worker
133*912701f9SAndroid Build Coastguard WorkerCalendars that use cyclicNameSets and monthPatterns (such as Chinese and Dangi) have additional symbols and distinct formats, and typically inherit these items (along with month names) from their parent locales, instead of inheriting them from Gregorian or generic data in the same locale.
134*912701f9SAndroid Build Coastguard Worker
135*912701f9SAndroid Build Coastguard WorkerThe primary difference between Gregorian and "generic" format data is that date formats in "generic" usually include era with year, in order to provide an indication of which calendar is being used (Gregorian calendar formats may also commonly include era with year when Gregorian is not the default calendar for the locale). Otherwise, the "generic" date formats should normally be consistent with those in the Gregorian calendar. The "generic" calendar formats are intended to provide a consistent set of default formats for non-Gregorian calendars in the locale, so that in most cases the only data items that need be provided for non-Gregorian calendars are the era names and month names (and the latter only for calendars other than Buddhist, Japanese, and Minguo, since those inherit month names from Gregorian).
136*912701f9SAndroid Build Coastguard Worker
137*912701f9SAndroid Build Coastguard Worker### <a name="months_days_quarters_eras" href="#months_days_quarters_eras">Elements months, days, quarters, eras</a>
138*912701f9SAndroid Build Coastguard Worker
139*912701f9SAndroid Build Coastguard Worker```xml
140*912701f9SAndroid Build Coastguard Worker<!ELEMENT months ( alias | (monthContext*, special*)) >
141*912701f9SAndroid Build Coastguard Worker<!ELEMENT monthContext ( alias | (default*, monthWidth*, special*)) >
142*912701f9SAndroid Build Coastguard Worker<!ATTLIST monthContext type ( format | stand-alone ) #REQUIRED >
143*912701f9SAndroid Build Coastguard Worker<!ELEMENT monthWidth ( alias | (month*, special*)) >
144*912701f9SAndroid Build Coastguard Worker<!ATTLIST monthWidth type ( abbreviated| narrow | wide) #REQUIRED >
145*912701f9SAndroid Build Coastguard Worker<!ELEMENT month ( #PCDATA )* >
146*912701f9SAndroid Build Coastguard Worker<!ATTLIST month type ( 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 ) #REQUIRED >
147*912701f9SAndroid Build Coastguard Worker<!ATTLIST month yeartype ( standard | leap ) #IMPLIED >
148*912701f9SAndroid Build Coastguard Worker
149*912701f9SAndroid Build Coastguard Worker<!ELEMENT days ( alias | (dayContext*, special*)) >
150*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayContext ( alias | (default*, dayWidth*, special*)) >
151*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayContext type ( format | stand-alone ) #REQUIRED >
152*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayWidth ( alias | (day*, special*)) >
153*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayWidth type NMTOKEN #REQUIRED >
154*912701f9SAndroid Build Coastguard Worker<!ELEMENT day ( #PCDATA ) >
155*912701f9SAndroid Build Coastguard Worker<!ATTLIST day type ( sun | mon | tue | wed | thu | fri | sat ) #REQUIRED >
156*912701f9SAndroid Build Coastguard Worker
157*912701f9SAndroid Build Coastguard Worker<!ELEMENT quarters ( alias | (quarterContext*, special*)) >
158*912701f9SAndroid Build Coastguard Worker<!ELEMENT quarterContext ( alias | (default*, quarterWidth*, special*)) >
159*912701f9SAndroid Build Coastguard Worker<!ATTLIST quarterContext type ( format | stand-alone ) #REQUIRED >
160*912701f9SAndroid Build Coastguard Worker<!ELEMENT quarterWidth ( alias | (quarter*, special*)) >
161*912701f9SAndroid Build Coastguard Worker<!ATTLIST quarterWidth type NMTOKEN #REQUIRED >
162*912701f9SAndroid Build Coastguard Worker<!ELEMENT quarter ( #PCDATA ) >
163*912701f9SAndroid Build Coastguard Worker<!ATTLIST quarter type ( 1 | 2 | 3 | 4 ) #REQUIRED >
164*912701f9SAndroid Build Coastguard Worker
165*912701f9SAndroid Build Coastguard Worker<!ELEMENT eras (alias | (eraNames?, eraAbbr?, eraNarrow?, special*)) >
166*912701f9SAndroid Build Coastguard Worker<!ELEMENT eraNames ( alias | (era*, special*) ) >
167*912701f9SAndroid Build Coastguard Worker<!ELEMENT eraAbbr ( alias | (era*, special*) ) >
168*912701f9SAndroid Build Coastguard Worker<!ELEMENT eraNarrow ( alias | (era*, special*) ) >
169*912701f9SAndroid Build Coastguard Worker```
170*912701f9SAndroid Build Coastguard Worker
171*912701f9SAndroid Build Coastguard WorkerThe month and quarter names are identified numerically, starting at 1. The weekday names are identified with short strings, since there is no universally-accepted numeric designation.
172*912701f9SAndroid Build Coastguard Worker
173*912701f9SAndroid Build Coastguard WorkerMonth, day, and quarter names may vary along two axes: the width and the context.
174*912701f9SAndroid Build Coastguard Worker
175*912701f9SAndroid Build Coastguard WorkerThe context is either _format_ (the default), the form used within a complete date format string (such as "Saturday, November 12"), or _stand-alone_, the form for date elements used independently, such as in calendar headers. The _stand-alone_ form may be used in any other date format that shares the same form of the name. For month names, this is typically the nominative grammatical form, and might also be used in patterns such as "LLLL y" (month name + year). The _format_ form is an additional form that can be used in contexts where it is different than the stand-alone form. For example, in many languages, patterns that combine month name with day-of-month (and possibly other elements) may require the month name to be in a grammatical form such as genitive or partitive.
176*912701f9SAndroid Build Coastguard Worker* In past versions of CLDR, the distinction between format and stand-alone forms was used to control capitalization (with stand-alone forms using titlecase); however, this can be controlled separately and more precisely using the `<contextTransforms>` element as described in _[ContextTransform Elements](tr35-general.md#Context_Transform_Elements)_, so both format and stand-alone forms should generally use middle-of-sentence capitalization.
177*912701f9SAndroid Build Coastguard Worker* However, if in a given language, certain context/width combinations are always used in a titlecase form — for example, stand-alone narrow forms for months or weekdays — then these should be provided in that form.
178*912701f9SAndroid Build Coastguard Worker* The distinctions between stand-alone (e.g. LLLL) and format (e.g. MMMM) forms are only relevant for how date elements are used within a date format. They are not intended to reflect how a date format is used within a sentence. For example, they are not intended to be used to generate the dative form of a date format when that format is used after a preposition that takes dative form.
179*912701f9SAndroid Build Coastguard Worker
180*912701f9SAndroid Build Coastguard WorkerThe width can be _wide_ (the default), _abbreviated_, or _narrow_; for days only, the width can also be _short,_ which is ideally between the abbreviated and narrow widths, but must be no longer than abbreviated and no shorter than narrow (if short day names are not explicitly specified, abbreviated day names are used instead). Note that for `<monthPattern>`, described in the next section:
181*912701f9SAndroid Build Coastguard Worker
182*912701f9SAndroid Build Coastguard Worker*   There is an additional context type _numeric_
183*912701f9SAndroid Build Coastguard Worker*   When the context type is numeric, the width has a special type _all_
184*912701f9SAndroid Build Coastguard Worker
185*912701f9SAndroid Build Coastguard WorkerThe format values must be distinct for the wide, abbreviated, and short widths. However, values for the narrow width in either format or stand-alone contexts, as well as values for other widths in stand-alone contexts, need not be distinct; they might only be distinguished by context. For example, "S" may be used both for Saturday and for Sunday. The narrow width is typically used in calendar headers; it must be the shortest possible width, no more than one character (or grapheme cluster, or exemplar set element) in stand-alone values (not including punctuation), and the shortest possible widths (in terms of grapheme clusters) in format values. The short width (if present) is often the shortest unambiguous form.
186*912701f9SAndroid Build Coastguard Worker
187*912701f9SAndroid Build Coastguard WorkerEra names should be distinct within each of the widths, including narrow; there is less disambiguating information for them, and they are more likely to be used in a format that requires parsing.
188*912701f9SAndroid Build Coastguard Worker
189*912701f9SAndroid Build Coastguard WorkerDue to aliases in root, the forms inherit "sideways". (See _[Multiple Inheritance](tr35.md#Multiple_Inheritance)_.) For example, if the abbreviated format data for Gregorian does not exist in a language X (in the chain up to root), then it inherits from the wide format data in that same language X.
190*912701f9SAndroid Build Coastguard Worker
191*912701f9SAndroid Build Coastguard Worker```xml
192*912701f9SAndroid Build Coastguard Worker<monthContext type="format">
193*912701f9SAndroid Build Coastguard Worker    <monthWidth type="abbreviated">
194*912701f9SAndroid Build Coastguard Worker        <alias source="locale" path="../monthWidth[@type='wide']"/>
195*912701f9SAndroid Build Coastguard Worker    </monthWidth>
196*912701f9SAndroid Build Coastguard Worker    <monthWidth type="narrow">
197*912701f9SAndroid Build Coastguard Worker        <alias source="locale" path="../../monthContext[@type='stand-alone']/monthWidth[@type='narrow']"/>
198*912701f9SAndroid Build Coastguard Worker    </monthWidth>
199*912701f9SAndroid Build Coastguard Worker    <monthWidth type="wide">
200*912701f9SAndroid Build Coastguard Worker        <month type="1">1</month>
201*912701f9SAndroid Build Coastguard Worker        ...
202*912701f9SAndroid Build Coastguard Worker        <month type="12">12</month>
203*912701f9SAndroid Build Coastguard Worker    </monthWidth>
204*912701f9SAndroid Build Coastguard Worker</monthContext>
205*912701f9SAndroid Build Coastguard Worker<monthContext type="stand-alone">
206*912701f9SAndroid Build Coastguard Worker    <monthWidth type="abbreviated">
207*912701f9SAndroid Build Coastguard Worker        <alias source="locale" path="../../monthContext[@type='format']/monthWidth[@type='abbreviated']"/>
208*912701f9SAndroid Build Coastguard Worker    </monthWidth>
209*912701f9SAndroid Build Coastguard Worker    <monthWidth type="narrow">
210*912701f9SAndroid Build Coastguard Worker        <month type="1">1</month>
211*912701f9SAndroid Build Coastguard Worker        ...
212*912701f9SAndroid Build Coastguard Worker        <month type="12">12</month>
213*912701f9SAndroid Build Coastguard Worker    </monthWidth>
214*912701f9SAndroid Build Coastguard Worker    <monthWidth type="wide">
215*912701f9SAndroid Build Coastguard Worker        <alias source="locale" path="../../monthContext[@type='format']/monthWidth[@type='wide']"/>
216*912701f9SAndroid Build Coastguard Worker    </monthWidth>
217*912701f9SAndroid Build Coastguard Worker</monthContext>
218*912701f9SAndroid Build Coastguard Worker```
219*912701f9SAndroid Build Coastguard Worker
220*912701f9SAndroid Build Coastguard WorkerThe `yeartype` attribute for months is used to distinguish alternate month names that would be displayed for certain calendars during leap years. The practical example of this usage occurs in the Hebrew calendar, where the 7th month "Adar" occurs in non-leap years, with the 6th month being skipped, but in leap years there are two months named "Adar I" and "Adar II". There are currently only two defined year types, standard (the implied default) and leap.
221*912701f9SAndroid Build Coastguard Worker
222*912701f9SAndroid Build Coastguard WorkerFor `era` elements, an additional `alt="variant"` form may be supplied. This is primarily intended for use in the "gregorian" calendar, with which two parallel sets of era designations are used in some locales: one set with a religious reference (e.g. English BC/AD), and one set without (e.g. English BCE/CE). The most commonly-used set for the locale should be provided as the default, and the other set may be provided as the `alt="variant"` forms. See the example below.
223*912701f9SAndroid Build Coastguard Worker
224*912701f9SAndroid Build Coastguard WorkerExample:
225*912701f9SAndroid Build Coastguard Worker
226*912701f9SAndroid Build Coastguard Worker```xml
227*912701f9SAndroid Build Coastguard Worker<calendar type="gregorian">
228*912701f9SAndroid Build Coastguard Worker    <months>
229*912701f9SAndroid Build Coastguard Worker        <monthContext type="format">
230*912701f9SAndroid Build Coastguard Worker            <monthWidth type="wide">
231*912701f9SAndroid Build Coastguard Worker                <month type="1">January</month>
232*912701f9SAndroid Build Coastguard Worker                <month type="2">February</month>
233*912701f9SAndroid Build Coastguard Worker                ...
234*912701f9SAndroid Build Coastguard Worker                <month type="11">November</month>
235*912701f9SAndroid Build Coastguard Worker                <month type="12">December</month>
236*912701f9SAndroid Build Coastguard Worker            </monthWidth>
237*912701f9SAndroid Build Coastguard Worker            <monthWidth type="abbreviated">
238*912701f9SAndroid Build Coastguard Worker                <month type="1">Jan</month>
239*912701f9SAndroid Build Coastguard Worker                <month type="2">Feb</month>
240*912701f9SAndroid Build Coastguard Worker                ...
241*912701f9SAndroid Build Coastguard Worker                <month type="11">Nov</month>
242*912701f9SAndroid Build Coastguard Worker                <month type="12">Dec</month>
243*912701f9SAndroid Build Coastguard Worker            </monthWidth>
244*912701f9SAndroid Build Coastguard Worker        </monthContext>
245*912701f9SAndroid Build Coastguard Worker        <monthContext type="stand-alone">
246*912701f9SAndroid Build Coastguard Worker            <default type="wide"/>
247*912701f9SAndroid Build Coastguard Worker            <monthWidth type="wide">
248*912701f9SAndroid Build Coastguard Worker                <month type="1">Januaria</month>
249*912701f9SAndroid Build Coastguard Worker                <month type="2">Februaria</month>
250*912701f9SAndroid Build Coastguard Worker                ...
251*912701f9SAndroid Build Coastguard Worker                <month type="11">Novembria</month>
252*912701f9SAndroid Build Coastguard Worker                <month type="12">Decembria</month>
253*912701f9SAndroid Build Coastguard Worker            </monthWidth>
254*912701f9SAndroid Build Coastguard Worker            <monthWidth type="narrow">
255*912701f9SAndroid Build Coastguard Worker                <month type="1">J</month>
256*912701f9SAndroid Build Coastguard Worker                <month type="2">F</month>
257*912701f9SAndroid Build Coastguard Worker                ...
258*912701f9SAndroid Build Coastguard Worker                <month type="11">N</month>
259*912701f9SAndroid Build Coastguard Worker                <month type="12">D</month>
260*912701f9SAndroid Build Coastguard Worker            </monthWidth>
261*912701f9SAndroid Build Coastguard Worker        </monthContext>
262*912701f9SAndroid Build Coastguard Worker    </months>
263*912701f9SAndroid Build Coastguard Worker
264*912701f9SAndroid Build Coastguard Worker    <days>
265*912701f9SAndroid Build Coastguard Worker        <dayContext type="format">
266*912701f9SAndroid Build Coastguard Worker            <dayWidth type="wide">
267*912701f9SAndroid Build Coastguard Worker                <day type="sun">Sunday</day>
268*912701f9SAndroid Build Coastguard Worker                <day type="mon">Monday</day>
269*912701f9SAndroid Build Coastguard Worker                ...
270*912701f9SAndroid Build Coastguard Worker                <day type="fri">Friday</day>
271*912701f9SAndroid Build Coastguard Worker                <day type="sat">Saturday</day>
272*912701f9SAndroid Build Coastguard Worker            </dayWidth>
273*912701f9SAndroid Build Coastguard Worker            <dayWidth type="abbreviated">
274*912701f9SAndroid Build Coastguard Worker                <day type="sun">Sun</day>
275*912701f9SAndroid Build Coastguard Worker                <day type="mon">Mon</day>
276*912701f9SAndroid Build Coastguard Worker                ...
277*912701f9SAndroid Build Coastguard Worker                <day type="fri">Fri</day>
278*912701f9SAndroid Build Coastguard Worker                <day type="sat">Sat</day>
279*912701f9SAndroid Build Coastguard Worker            </dayWidth>
280*912701f9SAndroid Build Coastguard Worker            <dayWidth type="narrow">
281*912701f9SAndroid Build Coastguard Worker                <day type="sun">Su</day>
282*912701f9SAndroid Build Coastguard Worker                <day type="mon">M</day>
283*912701f9SAndroid Build Coastguard Worker                ...
284*912701f9SAndroid Build Coastguard Worker                <day type="fri">F</day>
285*912701f9SAndroid Build Coastguard Worker                <day type="sat">Sa</day>
286*912701f9SAndroid Build Coastguard Worker            </dayWidth>
287*912701f9SAndroid Build Coastguard Worker        </dayContext>
288*912701f9SAndroid Build Coastguard Worker        <dayContext type="stand-alone">
289*912701f9SAndroid Build Coastguard Worker            <dayWidth type="narrow">
290*912701f9SAndroid Build Coastguard Worker                <day type="sun">S</day>
291*912701f9SAndroid Build Coastguard Worker                <day type="mon">M</day>
292*912701f9SAndroid Build Coastguard Worker                ...
293*912701f9SAndroid Build Coastguard Worker                <day type="fri">F</day>
294*912701f9SAndroid Build Coastguard Worker                <day type="sat">S</day>
295*912701f9SAndroid Build Coastguard Worker            </dayWidth>
296*912701f9SAndroid Build Coastguard Worker        </dayContext>
297*912701f9SAndroid Build Coastguard Worker    </days>
298*912701f9SAndroid Build Coastguard Worker
299*912701f9SAndroid Build Coastguard Worker    <quarters>
300*912701f9SAndroid Build Coastguard Worker        <quarterContext type="format">
301*912701f9SAndroid Build Coastguard Worker            <quarterWidth type="abbreviated">
302*912701f9SAndroid Build Coastguard Worker                <quarter type="1">Q1</quarter>
303*912701f9SAndroid Build Coastguard Worker                <quarter type="2">Q2</quarter>
304*912701f9SAndroid Build Coastguard Worker                <quarter type="3">Q3</quarter>
305*912701f9SAndroid Build Coastguard Worker                <quarter type="4">Q4</quarter>
306*912701f9SAndroid Build Coastguard Worker            </quarterWidth>
307*912701f9SAndroid Build Coastguard Worker            <quarterWidth type="wide">
308*912701f9SAndroid Build Coastguard Worker                <quarter type="1">1st quarter</quarter>
309*912701f9SAndroid Build Coastguard Worker                <quarter type="2">2nd quarter</quarter>
310*912701f9SAndroid Build Coastguard Worker                <quarter type="3">3rd quarter</quarter>
311*912701f9SAndroid Build Coastguard Worker                <quarter type="4">4th quarter</quarter>
312*912701f9SAndroid Build Coastguard Worker            </quarterWidth>
313*912701f9SAndroid Build Coastguard Worker        </quarterContext>
314*912701f9SAndroid Build Coastguard Worker    </quarters>
315*912701f9SAndroid Build Coastguard Worker
316*912701f9SAndroid Build Coastguard Worker    <eras>
317*912701f9SAndroid Build Coastguard Worker        <eraAbbr>
318*912701f9SAndroid Build Coastguard Worker            <era type="0">BC</era>
319*912701f9SAndroid Build Coastguard Worker            <era type="0" alt="variant">BCE</era>
320*912701f9SAndroid Build Coastguard Worker            <era type="1">AD</era>
321*912701f9SAndroid Build Coastguard Worker            <era type="1" alt="variant">CE</era>
322*912701f9SAndroid Build Coastguard Worker        </eraAbbr>
323*912701f9SAndroid Build Coastguard Worker        <eraNames>
324*912701f9SAndroid Build Coastguard Worker            <era type="0">Before Christ</era>
325*912701f9SAndroid Build Coastguard Worker            <era type="0" alt="variant">Before Common Era</era>
326*912701f9SAndroid Build Coastguard Worker            <era type="1">Anno Domini</era>
327*912701f9SAndroid Build Coastguard Worker            <era type="1" alt="variant">Common Era</era>
328*912701f9SAndroid Build Coastguard Worker        </eraNames>
329*912701f9SAndroid Build Coastguard Worker        <eraNarrow>
330*912701f9SAndroid Build Coastguard Worker            <era type="0">B</era>
331*912701f9SAndroid Build Coastguard Worker            <era type="1">A</era>
332*912701f9SAndroid Build Coastguard Worker        </eraNarrow>
333*912701f9SAndroid Build Coastguard Worker    </eras>
334*912701f9SAndroid Build Coastguard Worker```
335*912701f9SAndroid Build Coastguard Worker
336*912701f9SAndroid Build Coastguard Worker### <a name="monthPatterns_cyclicNameSets" href="#monthPatterns_cyclicNameSets">Elements monthPatterns, cyclicNameSets</a>
337*912701f9SAndroid Build Coastguard Worker
338*912701f9SAndroid Build Coastguard Worker```xml
339*912701f9SAndroid Build Coastguard Worker<!ELEMENT monthPatterns ( alias | (monthPatternContext*, special*)) >
340*912701f9SAndroid Build Coastguard Worker<!ELEMENT monthPatternContext ( alias | (monthPatternWidth*, special*)) >
341*912701f9SAndroid Build Coastguard Worker<!ATTLIST monthPatternContext type ( format | stand-alone | numeric ) #REQUIRED >
342*912701f9SAndroid Build Coastguard Worker<!ELEMENT monthPatternWidth ( alias | (monthPattern*, special*)) >
343*912701f9SAndroid Build Coastguard Worker<!ATTLIST monthPatternWidth type ( abbreviated| narrow | wide | all ) #REQUIRED >
344*912701f9SAndroid Build Coastguard Worker<!ELEMENT monthPattern ( #PCDATA ) >
345*912701f9SAndroid Build Coastguard Worker<!ATTLIST monthPattern type ( leap | standardAfterLeap | combined ) #REQUIRED >
346*912701f9SAndroid Build Coastguard Worker
347*912701f9SAndroid Build Coastguard Worker<!ELEMENT cyclicNameSets ( alias | (cyclicNameSet*, special*)) >
348*912701f9SAndroid Build Coastguard Worker<!ELEMENT cyclicNameSet ( alias | (cyclicNameContext*, special*)) >
349*912701f9SAndroid Build Coastguard Worker<!ATTLIST cyclicNameSet type ( years | months | days | dayParts | zodiacs | solarTerms ) #REQUIRED >
350*912701f9SAndroid Build Coastguard Worker<!ELEMENT cyclicNameContext ( alias | (cyclicNameWidth*, special*)) >
351*912701f9SAndroid Build Coastguard Worker<!ATTLIST cyclicNameContext type ( format | stand-alone ) #REQUIRED >
352*912701f9SAndroid Build Coastguard Worker<!ELEMENT cyclicNameWidth ( alias | (cyclicName*, special*)) >
353*912701f9SAndroid Build Coastguard Worker<!ATTLIST cyclicNameWidth type ( abbreviated | narrow | wide ) #REQUIRED >
354*912701f9SAndroid Build Coastguard Worker<!ELEMENT cyclicName ( #PCDATA ) >
355*912701f9SAndroid Build Coastguard Worker<!ATTLIST cyclicName type NMTOKEN #REQUIRED >
356*912701f9SAndroid Build Coastguard Worker```
357*912701f9SAndroid Build Coastguard Worker
358*912701f9SAndroid Build Coastguard WorkerThe Chinese lunar calendar can insert a leap month after nearly any month of its year; when this happens, the month takes the name of the preceding month plus a special marker. The Hindu lunar calendars can insert a leap month before any one or two months of the year; when this happens, not only does the leap month take the name of the following month plus a special marker, the following month also takes a special marker. Moreover, in the Hindu calendar sometimes a month is skipped, in which case the preceding month takes a special marker plus the names of both months. The `<monthPatterns>` element structure supports these special kinds of month names. It parallels the `<months>` element structure, with various contexts and widths, but with some differences:
359*912701f9SAndroid Build Coastguard Worker
360*912701f9SAndroid Build Coastguard Worker* Since the month markers may be applied to numeric months as well, there is an additional `monthPatternContext` type `numeric` for this case. When the numeric context is used, there is no need for different widths, so the `monthPatternWidth` type is `all` for this case.
361*912701f9SAndroid Build Coastguard Worker* The `<monthPattern>` element itself is a pattern showing how to create the modified month name from the standard month name(s). The three types of possible pattern are for `leap`, `standardAfterLeap`, and `combined`.
362*912701f9SAndroid Build Coastguard Worker* The `<monthPatterns>` element is not present for calendars that do not need it.
363*912701f9SAndroid Build Coastguard Worker
364*912701f9SAndroid Build Coastguard WorkerThe Chinese and Hindu lunar calendars also use a 60-name cycle for designating years. The Chinese lunar calendars can also use that cycle for months and days, and can use 12-name cycles for designating day subdivisions or zodiac names associated with years; a 24-name cycle of solar terms (12 pairs of minor and major terms) is used to mark intervals in the solar cycle. The `<cyclicNameSets>` element structure supports these special kinds of name cycles; a `cyclicNameSet` can be provided for types `year`, `month`, `day`, `dayParts`, or `zodiacs`. For each `cyclicNameSet`, there is a context and width structure similar to that for day names. For a given context and width, a set of `cyclicName` elements provides the actual names.
365*912701f9SAndroid Build Coastguard Worker
366*912701f9SAndroid Build Coastguard WorkerExample:
367*912701f9SAndroid Build Coastguard Worker
368*912701f9SAndroid Build Coastguard Worker```xml
369*912701f9SAndroid Build Coastguard Worker    <monthPatterns>
370*912701f9SAndroid Build Coastguard Worker        <monthPatternContext type="format">
371*912701f9SAndroid Build Coastguard Worker            <monthPatternWidth type="wide">
372*912701f9SAndroid Build Coastguard Worker                <monthPattern type="leap">闰{0}</monthPattern>
373*912701f9SAndroid Build Coastguard Worker            </monthPatternWidth>
374*912701f9SAndroid Build Coastguard Worker        </monthPatternContext>
375*912701f9SAndroid Build Coastguard Worker        <monthPatternContext type="stand-alone">
376*912701f9SAndroid Build Coastguard Worker            <monthPatternWidth type="narrow">
377*912701f9SAndroid Build Coastguard Worker                <monthPattern type="leap">闰{0}</monthPattern>
378*912701f9SAndroid Build Coastguard Worker            </monthPatternWidth>
379*912701f9SAndroid Build Coastguard Worker        </monthPatternContext>
380*912701f9SAndroid Build Coastguard Worker        <monthPatternContext type="numeric">
381*912701f9SAndroid Build Coastguard Worker            <monthPatternWidth type="all">
382*912701f9SAndroid Build Coastguard Worker                <monthPattern type="leap">闰{0}</monthPattern>
383*912701f9SAndroid Build Coastguard Worker            </monthPatternWidth>
384*912701f9SAndroid Build Coastguard Worker        </monthPatternContext>
385*912701f9SAndroid Build Coastguard Worker    </monthPatterns>
386*912701f9SAndroid Build Coastguard Worker    <cyclicNameSets>
387*912701f9SAndroid Build Coastguard Worker        <cyclicNameSet type="years">
388*912701f9SAndroid Build Coastguard Worker            <cyclicNameContext type="format">
389*912701f9SAndroid Build Coastguard Worker                <cyclicNameWidth type="abbreviated">
390*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="1">甲子</cyclicName>
391*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="2">乙丑</cyclicName>
392*912701f9SAndroid Build Coastguard Worker                    ...
393*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="59">壬戌</cyclicName>
394*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="60">癸亥</cyclicName>
395*912701f9SAndroid Build Coastguard Worker                </cyclicNameWidth>
396*912701f9SAndroid Build Coastguard Worker            </cyclicNameContext>
397*912701f9SAndroid Build Coastguard Worker        </cyclicNameSet>
398*912701f9SAndroid Build Coastguard Worker        <cyclicNameSet type="zodiacs">
399*912701f9SAndroid Build Coastguard Worker            <cyclicNameContext type="format">
400*912701f9SAndroid Build Coastguard Worker                <cyclicNameWidth type="abbreviated">
401*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="1">鼠</cyclicName>
402*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="2">牛</cyclicName>
403*912701f9SAndroid Build Coastguard Worker                    ...
404*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="11">狗</cyclicName>
405*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="12">猪</cyclicName>
406*912701f9SAndroid Build Coastguard Worker                </cyclicNameWidth>
407*912701f9SAndroid Build Coastguard Worker            </cyclicNameContext>
408*912701f9SAndroid Build Coastguard Worker        </cyclicNameSet>
409*912701f9SAndroid Build Coastguard Worker        <cyclicNameSet type="solarTerms">
410*912701f9SAndroid Build Coastguard Worker            <cyclicNameContext type="format">
411*912701f9SAndroid Build Coastguard Worker                <cyclicNameWidth type="abbreviated">
412*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="1">立春</cyclicName>
413*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="2">雨水</cyclicName>
414*912701f9SAndroid Build Coastguard Worker                    ...
415*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="23">小寒</cyclicName>
416*912701f9SAndroid Build Coastguard Worker                    <cyclicName type="24">大寒</cyclicName>
417*912701f9SAndroid Build Coastguard Worker                </cyclicNameWidth>
418*912701f9SAndroid Build Coastguard Worker            </cyclicNameContext>
419*912701f9SAndroid Build Coastguard Worker        </cyclicNameSet>
420*912701f9SAndroid Build Coastguard Worker    </cyclicNameSets>
421*912701f9SAndroid Build Coastguard Worker```
422*912701f9SAndroid Build Coastguard Worker
423*912701f9SAndroid Build Coastguard Worker### <a name="dayPeriods" href="#dayPeriods">Element dayPeriods</a>
424*912701f9SAndroid Build Coastguard Worker
425*912701f9SAndroid Build Coastguard WorkerThe former `am`/`pm` elements have been deprecated, and replaced by the more flexible `dayPeriods`.
426*912701f9SAndroid Build Coastguard Worker
427*912701f9SAndroid Build Coastguard Worker```xml
428*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayPeriods ( alias | (dayPeriodContext*) ) >
429*912701f9SAndroid Build Coastguard Worker
430*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayPeriodContext (alias | dayPeriodWidth*) >
431*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriodContext type NMTOKEN #REQUIRED >
432*912701f9SAndroid Build Coastguard Worker
433*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayPeriodWidth (alias | dayPeriod*) >
434*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriodWidth type NMTOKEN #REQUIRED >
435*912701f9SAndroid Build Coastguard Worker
436*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayPeriod ( #PCDATA ) >
437*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriod type NMTOKEN #REQUIRED >
438*912701f9SAndroid Build Coastguard Worker```
439*912701f9SAndroid Build Coastguard Worker
440*912701f9SAndroid Build Coastguard WorkerThese behave like months, days, and so on in terms of having context and width. Each locale has an associated dayPeriodRuleSet in the supplemental data, rules that specify when the day periods start and end for that locale. Each type in the rules needs to have a translation in a dayPeriod (but if translation data is missing for a particular variable dayPeriod in the locale’s language and script, formatting should fall back to using the am/pm values). For more information, see _[Day Period Rules](#Day_Period_Rules)_.
441*912701f9SAndroid Build Coastguard Worker
442*912701f9SAndroid Build Coastguard WorkerThe dayPeriod names should be distinct within each of the context/width combinations, including narrow; as with era names, there is less disambiguating information for them, and they are more likely to be used in a format that requires parsing. In some unambiguous cases, it is acceptable for certain overlapping dayPeriods to be the same, such as the names for "am" and "morning", or the names for "pm" and "afternoon".
443*912701f9SAndroid Build Coastguard Worker
444*912701f9SAndroid Build Coastguard WorkerExample:
445*912701f9SAndroid Build Coastguard Worker
446*912701f9SAndroid Build Coastguard Worker```xml
447*912701f9SAndroid Build Coastguard Worker    <dayPeriods>
448*912701f9SAndroid Build Coastguard Worker        <dayPeriodContext type="format">
449*912701f9SAndroid Build Coastguard Worker            <dayPeriodWidth type="wide">
450*912701f9SAndroid Build Coastguard Worker                <dayPeriod type="am">AM</dayPeriod>
451*912701f9SAndroid Build Coastguard Worker                <dayPeriod type="noon">noon</dayPeriod>
452*912701f9SAndroid Build Coastguard Worker                <dayPeriod type="pm">PM</dayPeriod>
453*912701f9SAndroid Build Coastguard Worker            </dayPeriodWidth>
454*912701f9SAndroid Build Coastguard Worker        </dayPeriodContext>
455*912701f9SAndroid Build Coastguard Worker    </dayPeriods>
456*912701f9SAndroid Build Coastguard Worker```
457*912701f9SAndroid Build Coastguard Worker
458*912701f9SAndroid Build Coastguard Worker### <a name="dateFormats" href="#dateFormats">Element dateFormats</a>
459*912701f9SAndroid Build Coastguard Worker
460*912701f9SAndroid Build Coastguard Worker```xml
461*912701f9SAndroid Build Coastguard Worker<!ELEMENT dateFormats (alias | (default*, dateFormatLength*, special*)) >
462*912701f9SAndroid Build Coastguard Worker<!ELEMENT dateFormatLength (alias | (default*, dateFormat*, special*)) >
463*912701f9SAndroid Build Coastguard Worker<!ATTLIST dateFormatLength type ( full | long | medium | short ) #REQUIRED >
464*912701f9SAndroid Build Coastguard Worker<!ELEMENT dateFormat (alias | (pattern*, datetimeSkeleton*, displayName*, special*)) >
465*912701f9SAndroid Build Coastguard Worker<!ELEMENT pattern ( #PCDATA ) >
466*912701f9SAndroid Build Coastguard Worker<!ATTLIST pattern numbers CDATA #IMPLIED >
467*912701f9SAndroid Build Coastguard Worker<!ATTLIST pattern alt NMTOKENS #IMPLIED >
468*912701f9SAndroid Build Coastguard Worker<!ATTLIST pattern draft (approved | contributed | provisional | unconfirmed) #IMPLIED >
469*912701f9SAndroid Build Coastguard Worker<!ELEMENT datetimeSkeleton ( #PCDATA ) >
470*912701f9SAndroid Build Coastguard Worker<!ATTLIST datetimeSkeleton numbers CDATA #IMPLIED >
471*912701f9SAndroid Build Coastguard Worker<!ATTLIST datetimeSkeleton alt NMTOKENS #IMPLIED >
472*912701f9SAndroid Build Coastguard Worker<!ATTLIST datetimeSkeleton draft (approved | contributed | provisional | unconfirmed) #IMPLIED >
473*912701f9SAndroid Build Coastguard Worker```
474*912701f9SAndroid Build Coastguard Worker
475*912701f9SAndroid Build Coastguard WorkerStandard date formats have the following form:
476*912701f9SAndroid Build Coastguard Worker
477*912701f9SAndroid Build Coastguard Worker```xml
478*912701f9SAndroid Build Coastguard Worker    <dateFormats>
479*912701f9SAndroid Build Coastguard Worker        <dateFormatLength type="full">
480*912701f9SAndroid Build Coastguard Worker            <dateFormat>
481*912701f9SAndroid Build Coastguard Worker                <pattern>EEEE, MMMM d, y</pattern>
482*912701f9SAndroid Build Coastguard Worker                <datetimeSkeleton>yMMMMEEEEd</datetimeSkeleton>
483*912701f9SAndroid Build Coastguard Worker            </dateFormat>
484*912701f9SAndroid Build Coastguard Worker        </dateFormatLength>
485*912701f9SAndroid Build Coastguard Worker        ...
486*912701f9SAndroid Build Coastguard Worker        <dateFormatLength type="medium">
487*912701f9SAndroid Build Coastguard Worker            <dateFormat>
488*912701f9SAndroid Build Coastguard Worker                <pattern>MMM d, y</pattern>
489*912701f9SAndroid Build Coastguard Worker                <datetimeSkeleton>yMMMd</datetimeSkeleton>
490*912701f9SAndroid Build Coastguard Worker            </dateFormat>
491*912701f9SAndroid Build Coastguard Worker        </dateFormatLength>
492*912701f9SAndroid Build Coastguard Worker        ...
493*912701f9SAndroid Build Coastguard Worker    <dateFormats>
494*912701f9SAndroid Build Coastguard Worker
495*912701f9SAndroid Build Coastguard Worker    <dateFormats>
496*912701f9SAndroid Build Coastguard Worker        ...
497*912701f9SAndroid Build Coastguard Worker        <dateFormatLength type="medium">
498*912701f9SAndroid Build Coastguard Worker            <dateFormat>
499*912701f9SAndroid Build Coastguard Worker                <pattern numbers="hebr">d בMMMM y</pattern>
500*912701f9SAndroid Build Coastguard Worker                <datetimeSkeleton numbers="hebr">yMMMMd</datetimeSkeleton>
501*912701f9SAndroid Build Coastguard Worker            </dateFormat>
502*912701f9SAndroid Build Coastguard Worker        </dateFormatLength>
503*912701f9SAndroid Build Coastguard Worker        ...
504*912701f9SAndroid Build Coastguard Worker    <dateFormats>
505*912701f9SAndroid Build Coastguard Worker
506*912701f9SAndroid Build Coastguard Worker    <dateFormats>
507*912701f9SAndroid Build Coastguard Worker        ...
508*912701f9SAndroid Build Coastguard Worker        <dateFormatLength type="long">
509*912701f9SAndroid Build Coastguard Worker            <dateFormat>
510*912701f9SAndroid Build Coastguard Worker                <pattern numbers="d=hanidays">rU年MMMMd</pattern>
511*912701f9SAndroid Build Coastguard Worker                <datetimeSkeleton numbers="d=hanidays">rMMMMd</datetimeSkeleton>
512*912701f9SAndroid Build Coastguard Worker            </dateFormat>
513*912701f9SAndroid Build Coastguard Worker        </dateFormatLength>
514*912701f9SAndroid Build Coastguard Worker        ...
515*912701f9SAndroid Build Coastguard Worker```
516*912701f9SAndroid Build Coastguard Worker
517*912701f9SAndroid Build Coastguard WorkerThe patterns for date formats and time formats are defined in _[Date Format Patterns](#Date_Format_Patterns)._ These patterns are intended primarily for display of isolated date and time strings in user-interface elements, rather than for date and time strings in the middle of running text, so capitalization and grammatical form should be chosen appropriately.
518*912701f9SAndroid Build Coastguard Worker
519*912701f9SAndroid Build Coastguard WorkerStandard date and time patterns are each normally provided in four types: full (usually with weekday name), long (with wide month name), medium, and short (usually with numeric month).
520*912701f9SAndroid Build Coastguard Worker
521*912701f9SAndroid Build Coastguard WorkerThe `numbers` attribute can be used to explicitly specify a number system to be used for all of the numeric fields in the date format (as in `numbers="hebr"`), or for a specific field in the date format (as in `numbers="d=hanidays"`). This attribute overrides any default numbering system specified for the locale.
522*912701f9SAndroid Build Coastguard Worker
523*912701f9SAndroid Build Coastguard WorkerThe `datetimeSkeleton` element contains a _skeleton_ (see [availableFormats](#availableFormats_appendItems)) derived from the pattern. In the future the intent is to be able to generate the standard patterns from these `datetimeSkeleton` elements. However, in CLDR 40, the mechanisms associated with the `availableFormats` elements are not quite powerful enough to generate patterns that exactly match all of the ones provided in the `pattern` elements.
524*912701f9SAndroid Build Coastguard Worker
525*912701f9SAndroid Build Coastguard Worker### <a name="timeFormats" href="#timeFormats">Element timeFormats</a>
526*912701f9SAndroid Build Coastguard Worker
527*912701f9SAndroid Build Coastguard Worker```xml
528*912701f9SAndroid Build Coastguard Worker<!ELEMENT timeFormats (alias | (default*, timeFormatLength*, special*)) >
529*912701f9SAndroid Build Coastguard Worker<!ELEMENT timeFormatLength (alias | (default*, timeFormat*, special*)) >
530*912701f9SAndroid Build Coastguard Worker<!ATTLIST timeFormatLength type ( full | long | medium | short ) #REQUIRED >
531*912701f9SAndroid Build Coastguard Worker<!ELEMENT timeFormat (alias | (pattern*, datetimeSkeleton*, displayName*, special*)) >
532*912701f9SAndroid Build Coastguard Worker```
533*912701f9SAndroid Build Coastguard WorkerStandard time formats have the following form:
534*912701f9SAndroid Build Coastguard Worker
535*912701f9SAndroid Build Coastguard Worker```xml
536*912701f9SAndroid Build Coastguard Worker    <timeFormats>
537*912701f9SAndroid Build Coastguard Worker        <timeFormatLength type="full">
538*912701f9SAndroid Build Coastguard Worker            <timeFormat>
539*912701f9SAndroid Build Coastguard Worker                <displayName>DIN 5008 (EN 28601)</displayName>
540*912701f9SAndroid Build Coastguard Worker                <pattern>h:mm:ss a z</pattern>
541*912701f9SAndroid Build Coastguard Worker                <datetimeSkeleton>ahmmssz</datetimeSkeleton>
542*912701f9SAndroid Build Coastguard Worker            </timeFormat>
543*912701f9SAndroid Build Coastguard Worker        </timeFormatLength>
544*912701f9SAndroid Build Coastguard Worker        <timeFormatLength type="medium">
545*912701f9SAndroid Build Coastguard Worker            <timeFormat>
546*912701f9SAndroid Build Coastguard Worker                <pattern>h:mm:ss a</pattern>
547*912701f9SAndroid Build Coastguard Worker                <datetimeSkeleton>ahmmss</datetimeSkeleton>
548*912701f9SAndroid Build Coastguard Worker            </timeFormat>
549*912701f9SAndroid Build Coastguard Worker        </timeFormatLength>
550*912701f9SAndroid Build Coastguard Worker    </timeFormats>
551*912701f9SAndroid Build Coastguard Worker```
552*912701f9SAndroid Build Coastguard Worker
553*912701f9SAndroid Build Coastguard WorkerThe preference of 12 hour versus 24 hour for the locale can be derived from the [Time Data](#Time_Data). If the preferred hour symbol is 'h' or 'K' then the format is 12 hour; otherwise it is 24 hour. Formats with 'h' or 'K' must also include a field with one of the day period pattern characters: 'a', 'b', or 'B'.
554*912701f9SAndroid Build Coastguard Worker
555*912701f9SAndroid Build Coastguard WorkerTo account for customary usage in some countries, APIs should allow for formatting times that go beyond 23:59:59. For example, in some countries it would be customary to indicate that opening hours extending from _Friday at 7pm_ to _Saturday at 2am_ in a format like the following:
556*912701f9SAndroid Build Coastguard Worker
557*912701f9SAndroid Build Coastguard WorkerFriday: 19:00 – 26:00
558*912701f9SAndroid Build Coastguard Worker
559*912701f9SAndroid Build Coastguard WorkerTime formats use the specific non-location format (z or zzzz) for the time zone name. This is the format that should be used when formatting a specific time for presentation. When formatting a time referring to a recurring time (such as a meeting in a calendar), applications should substitute the generic non-location format (v or vvvv) for the time zone in the time format pattern. See _[Using Time Zone Names](#Using_Time_Zone_Names)_ for a complete description of available time zone formats and their uses.
560*912701f9SAndroid Build Coastguard Worker
561*912701f9SAndroid Build Coastguard Worker### <a name="dateTimeFormats" href="#dateTimeFormats">Element dateTimeFormats</a>
562*912701f9SAndroid Build Coastguard Worker
563*912701f9SAndroid Build Coastguard Worker```xml
564*912701f9SAndroid Build Coastguard Worker<!ELEMENT dateTimeFormats (alias | (default*, dateTimeFormatLength*, availableFormats*, appendItems*, intervalFormats*, special*)) >
565*912701f9SAndroid Build Coastguard Worker```
566*912701f9SAndroid Build Coastguard Worker
567*912701f9SAndroid Build Coastguard WorkerDate/Time formats have the following form:
568*912701f9SAndroid Build Coastguard Worker```xml
569*912701f9SAndroid Build Coastguard Worker    <dateTimeFormats>
570*912701f9SAndroid Build Coastguard Worker        <dateTimeFormatLength type="full">
571*912701f9SAndroid Build Coastguard Worker            <dateTimeFormat>
572*912701f9SAndroid Build Coastguard Worker                <pattern>{1}, {0}</pattern>
573*912701f9SAndroid Build Coastguard Worker            </dateTimeFormat>
574*912701f9SAndroid Build Coastguard Worker            <dateTimeFormat type="atTime">
575*912701f9SAndroid Build Coastguard Worker                <pattern>{1} 'at' {0}</pattern>
576*912701f9SAndroid Build Coastguard Worker            </dateTimeFormat>
577*912701f9SAndroid Build Coastguard Worker        </dateTimeFormatLength>
578*912701f9SAndroid Build Coastguard Worker        <dateTimeFormatLength type="long">
579*912701f9SAndroid Build Coastguard Worker            <dateTimeFormat>
580*912701f9SAndroid Build Coastguard Worker                <pattern>{1}, {0}</pattern>
581*912701f9SAndroid Build Coastguard Worker            </dateTimeFormat>
582*912701f9SAndroid Build Coastguard Worker            <dateTimeFormat type="atTime">
583*912701f9SAndroid Build Coastguard Worker                <pattern>{1} 'at' {0}</pattern>
584*912701f9SAndroid Build Coastguard Worker            </dateTimeFormat>
585*912701f9SAndroid Build Coastguard Worker        </dateTimeFormatLength>
586*912701f9SAndroid Build Coastguard Worker        <dateTimeFormatLength type="medium">
587*912701f9SAndroid Build Coastguard Worker            <dateTimeFormat>
588*912701f9SAndroid Build Coastguard Worker                <pattern>{1}, {0}</pattern>
589*912701f9SAndroid Build Coastguard Worker            </dateTimeFormat>
590*912701f9SAndroid Build Coastguard Worker        </dateTimeFormatLength>
591*912701f9SAndroid Build Coastguard Worker        <dateTimeFormatLength type="short">
592*912701f9SAndroid Build Coastguard Worker            <dateTimeFormat>
593*912701f9SAndroid Build Coastguard Worker                <pattern>{1}, {0}</pattern>
594*912701f9SAndroid Build Coastguard Worker            </dateTimeFormat>
595*912701f9SAndroid Build Coastguard Worker        </dateTimeFormatLength>
596*912701f9SAndroid Build Coastguard Worker        <availableFormats>
597*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="Hm">HH:mm</dateFormatItem>
598*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="Hms">HH:mm:ss</dateFormatItem>
599*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="M">L</dateFormatItem>
600*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="MEd">E, M/d</dateFormatItem>
601*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="MMM">LLL</dateFormatItem>
602*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="MMMEd">E, MMM d</dateFormatItem>
603*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="MMMMEd">E, MMMM d</dateFormatItem>
604*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="MMMMd">MMMM d</dateFormatItem>
605*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="MMMd">MMM d</dateFormatItem>
606*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="Md">M/d</dateFormatItem>
607*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="d">d</dateFormatItem>
608*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="hm">h:mm a</dateFormatItem>
609*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="ms">mm:ss</dateFormatItem>
610*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="y">yyyy</dateFormatItem>
611*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="yM">M/yyyy</dateFormatItem>
612*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="yMEd">EEE, M/d/yyyy</dateFormatItem>
613*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="yMMM">MMM yyyy</dateFormatItem>
614*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="yMMMEd">EEE, MMM d, yyyy</dateFormatItem>
615*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="yMMMM">MMMM yyyy</dateFormatItem>
616*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="yQ">Q yyyy</dateFormatItem>
617*912701f9SAndroid Build Coastguard Worker            <dateFormatItem id="yQQQ">QQQ yyyy</dateFormatItem>
618*912701f9SAndroid Build Coastguard Worker            . . .
619*912701f9SAndroid Build Coastguard Worker        </availableFormats>
620*912701f9SAndroid Build Coastguard Worker        <appendItems>
621*912701f9SAndroid Build Coastguard Worker            <appendItem request="Day">{0} ({2}: {1})</appendItem>
622*912701f9SAndroid Build Coastguard Worker            <appendItem request="Day-Of-Week">{0} {1}</appendItem>
623*912701f9SAndroid Build Coastguard Worker            <appendItem request="Era">{0} {1}</appendItem>
624*912701f9SAndroid Build Coastguard Worker            <appendItem request="Hour">{0} ({2}: {1})</appendItem>
625*912701f9SAndroid Build Coastguard Worker            . . .
626*912701f9SAndroid Build Coastguard Worker        </appendItems>
627*912701f9SAndroid Build Coastguard Worker    </dateTimeFormats>
628*912701f9SAndroid Build Coastguard Worker
629*912701f9SAndroid Build Coastguard Worker</calendar>
630*912701f9SAndroid Build Coastguard Worker
631*912701f9SAndroid Build Coastguard Worker<calendar type="buddhist">
632*912701f9SAndroid Build Coastguard Worker    <eras>
633*912701f9SAndroid Build Coastguard Worker        <eraAbbr>
634*912701f9SAndroid Build Coastguard Worker            <era type="0">BE</era>
635*912701f9SAndroid Build Coastguard Worker        </eraAbbr>
636*912701f9SAndroid Build Coastguard Worker    </eras>
637*912701f9SAndroid Build Coastguard Worker</calendar>
638*912701f9SAndroid Build Coastguard Worker```
639*912701f9SAndroid Build Coastguard Worker
640*912701f9SAndroid Build Coastguard WorkerThese formats allow for date and time formats to be composed in various ways.
641*912701f9SAndroid Build Coastguard Worker
642*912701f9SAndroid Build Coastguard Worker#### <a name="dateTimeFormat" href="#dateTimeFormat">Element dateTimeFormat</a>
643*912701f9SAndroid Build Coastguard Worker
644*912701f9SAndroid Build Coastguard Worker```xml
645*912701f9SAndroid Build Coastguard Worker<!ELEMENT dateTimeFormatLength (alias | (default*, dateTimeFormat*, special*))>
646*912701f9SAndroid Build Coastguard Worker<!ATTLIST dateTimeFormatLength type ( full | long | medium | short ) #IMPLIED >
647*912701f9SAndroid Build Coastguard Worker<!ELEMENT dateTimeFormat (alias | (pattern*, displayName*, special*))>
648*912701f9SAndroid Build Coastguard Worker<!ATTLIST dateTimeFormat type NMTOKEN "standard" >
649*912701f9SAndroid Build Coastguard Worker    <!--@MATCH:literal/standard, atTime-->
650*912701f9SAndroid Build Coastguard Worker```
651*912701f9SAndroid Build Coastguard Worker
652*912701f9SAndroid Build Coastguard WorkerThe `dateTimeFormat` element works like the dateFormats and timeFormats, except that the pattern is of the form "{1} {0}", where {0} is replaced by the time format, and {1} is replaced by the date format, with results such as "8/27/06 7:31 AM". Except for the substitution markers {0} and {1}, text in the dateTimeFormat is interpreted as part of a date/time pattern, and is subject to the same rules described in [Date Format Patterns](#Date_Format_Patterns). This includes the need to enclose ASCII letters in single quotes if they are intended to represent literal text.
653*912701f9SAndroid Build Coastguard Worker
654*912701f9SAndroid Build Coastguard WorkerWhen combining a standard date pattern with a standard time pattern, start with the `dateTimeFormatLength` whose `type` matches the type of the *date* pattern, and then use one of the `dateTimeFormat`s for that `dateTimeFormatLength` (as described after the following table). For example:
655*912701f9SAndroid Build Coastguard Worker
656*912701f9SAndroid Build Coastguard Worker###### Table: <a name="Date_Time_Combination_Examples" href="#Date_Time_Combination_Examples">Date-Time Combination Examples</a>
657*912701f9SAndroid Build Coastguard Worker
658*912701f9SAndroid Build Coastguard Worker| Date-Time Combination   | dateTimeFormat            | Results |
659*912701f9SAndroid Build Coastguard Worker| ----------------------- | ------------------------- | ------- |
660*912701f9SAndroid Build Coastguard Worker| full date + short time  | full, e.g. "{1} 'at' {0}" | Wednesday, September 18, 2013 at 4:30 PM |
661*912701f9SAndroid Build Coastguard Worker| medium date + long time | medium, e.g. "{1}, {0}"   | Sep 18, 2013, 4:30:00 PM PDT |
662*912701f9SAndroid Build Coastguard Worker
663*912701f9SAndroid Build Coastguard WorkerFor each `dateTimeFormatLength`, there is a standard `dateTimeFormat`. In addition to the placeholders {0} and {1}, this should not have characters other than space and punctuation; it should impose no grammatical context that might require specific grammatical forms for the date and/or time. For English, this might be “{1}, {0}”.
664*912701f9SAndroid Build Coastguard Worker
665*912701f9SAndroid Build Coastguard WorkerIn addition, especially for the full and long `dateTimeFormatLength`s, there may be a `dateTimeFormat` with `type="atTime"`. This is used to indicate an event at a specific time, and may impose specific grammatical requirements on the formats for date and/or time. For English, this might be “{1} 'at' {0}”.
666*912701f9SAndroid Build Coastguard Worker
667*912701f9SAndroid Build Coastguard WorkerThe default guidelines for choosing which `dateTimeFormat` to use for a given `dateTimeFormatLength` are as follows:
668*912701f9SAndroid Build Coastguard Worker* If an interval is being formatted, use the standard combining pattern to produce e.g. “March 15, 3:00 – 5:00 PM” or “March 15, 9:00 AM – March 16, 5:00 PM”.
669*912701f9SAndroid Build Coastguard Worker* If a single date or relative date is being combined with a single time, by default use the atTime pattern (if available) to produce an event time: “March 15 at 3:00 PM” or “tomorrow at 3:00 PM”.  However, at least in the case of combining a single date and time, APIs should also offer a “current time” option of using the standard combining pattern to produce a format more suitable for indicating  the current time: “March 15, 3:00 PM”.
670*912701f9SAndroid Build Coastguard Worker* For all other uses of these patterns, use the standard pattern.
671*912701f9SAndroid Build Coastguard Worker
672*912701f9SAndroid Build Coastguard Worker#### <a name="availableFormats_appendItems" href="#availableFormats_appendItems">Elements availableFormats, appendItems</a>
673*912701f9SAndroid Build Coastguard Worker
674*912701f9SAndroid Build Coastguard Worker```xml
675*912701f9SAndroid Build Coastguard Worker<!ELEMENT availableFormats (alias | (dateFormatItem*, special*))>
676*912701f9SAndroid Build Coastguard Worker<!ELEMENT dateFormatItem ( #PCDATA ) >
677*912701f9SAndroid Build Coastguard Worker<!ATTLIST dateFormatItem id CDATA #REQUIRED >
678*912701f9SAndroid Build Coastguard Worker```
679*912701f9SAndroid Build Coastguard Worker
680*912701f9SAndroid Build Coastguard WorkerThe `availableFormats` element and its subelements provide a more flexible formatting mechanism than the predefined list of patterns represented by dateFormatLength, timeFormatLength, and dateTimeFormatLength. Instead, there is an open-ended list of patterns (represented by `dateFormatItem` elements as well as the predefined patterns mentioned above) that can be matched against a requested set of calendar fields and field lengths. Software can look through the list and find the pattern that best matches the original request, based on the desired calendar fields and lengths. For example, the full month and year may be needed for a calendar application; the request is MMMMyyyy, but the best match may be "y MMMM" or even "G yy MMMM", depending on the locale and calendar.
681*912701f9SAndroid Build Coastguard Worker
682*912701f9SAndroid Build Coastguard WorkerFor some calendars, such as Japanese, a displayed year must have an associated era, so for these calendars dateFormatItem patterns with a year field should also include an era field. When matching availableFormats patterns: If a client requests a format string containing a year, and all the availableFormats patterns with a year also contain an era, then include the era as part of the result.
683*912701f9SAndroid Build Coastguard Worker
684*912701f9SAndroid Build Coastguard WorkerThe `id` attribute is a so-called "skeleton", containing only field information, and in a canonical order. Examples are "yMMMM" for year + full month, or "MMMd" for abbreviated month + day. In particular:
685*912701f9SAndroid Build Coastguard Worker
686*912701f9SAndroid Build Coastguard Worker* The fields are from the [Date Field Symbol Table](#Date_Field_Symbol_Table) in _[Date Format Patterns](#Date_Format_Patterns)_.
687*912701f9SAndroid Build Coastguard Worker* The canonical order is from top to bottom in that table; that is, "yM" not "My".
688*912701f9SAndroid Build Coastguard Worker* Only one field of each type is allowed; that is, "Hh" is not valid.
689*912701f9SAndroid Build Coastguard Worker
690*912701f9SAndroid Build Coastguard WorkerIn order to support user overrides of default locale behavior, data should be supplied for both 12-hour-cycle time formats (using h or K) and 24-hour-cycle time formats (using H or k), even if one of those styles is not commonly used; the locale's actual preference for 12-hour or 24-hour time cycle is determined from the [Time Data](#Time_Data) as described above in [timeFormats](#timeFormats). Thus skeletons using h or K should have patterns that only use h or K for hours, while skeletons using H or k should have patterns that only use H or k for hours.
691*912701f9SAndroid Build Coastguard Worker
692*912701f9SAndroid Build Coastguard WorkerThe rules governing use of day period pattern characters in patterns and skeletons are as follows:
693*912701f9SAndroid Build Coastguard Worker
694*912701f9SAndroid Build Coastguard Worker* Patterns and skeletons for 24-hour-cycle time formats (using H or k) currently _should not_ include fields with day period characters (a, b, or B); these pattern characters should be ignored if they appear in skeletons. However, in the future, CLDR may allow use of B (but not a or b) in 24-hour-cycle time formats.
695*912701f9SAndroid Build Coastguard Worker* Patterns for 12-hour-cycle time formats (using h or K) _must_ include a day period field using one of a, b, or B.
696*912701f9SAndroid Build Coastguard Worker* Skeletons for 12-hour-cycle time formats (using h or K) _may_ include a day period field using one of a, b, or B. If they do not, the skeleton will be treated as implicitly containing a.
697*912701f9SAndroid Build Coastguard Worker
698*912701f9SAndroid Build Coastguard WorkerLocales should generally provide availableFormats data for a fairly complete set of time skeletons without B, typically the following:
699*912701f9SAndroid Build Coastguard Worker
700*912701f9SAndroid Build Coastguard Worker`H, h, Hm, hm, Hms, hms, Hmv, hmv, Hmsv, hmsv`
701*912701f9SAndroid Build Coastguard Worker
702*912701f9SAndroid Build Coastguard WorkerLocales that use 12-hour-cycle time formats with B may provide availableFormats data for a smaller set of time skeletons with B, for example:
703*912701f9SAndroid Build Coastguard Worker
704*912701f9SAndroid Build Coastguard Worker`Bh, Bhm, Bhms`
705*912701f9SAndroid Build Coastguard Worker
706*912701f9SAndroid Build Coastguard WorkerWhen matching a requested skeleton containing b or B to the skeletons actually available in the data, if there is no skeleton matching the specified day period field, then find a match in which the b or B matches an explicit or implicit 'a' in the skeleton, but replace the 'a' in the corresponding pattern with the requested day period b or B. The following table illustrates how requested skeletons map to patterns with different sets of `availableFormats` data:
707*912701f9SAndroid Build Coastguard Worker
708*912701f9SAndroid Build Coastguard Worker###### Table: <a name="Mapping_Requested_Time_Skeletons_To_Patterns" href="#Mapping_Requested_Time_Skeletons_To_Patterns">Mapping Requested Time Skeletons To Patterns</a>
709*912701f9SAndroid Build Coastguard Worker
710*912701f9SAndroid Build Coastguard Worker<!-- HTML: spanning columns, header cells on non-first row -->
711*912701f9SAndroid Build Coastguard Worker<table><tbody>
712*912701f9SAndroid Build Coastguard Worker<tr><th></th><th colspan="2">results for different availableFormats data sets</th></tr>
713*912701f9SAndroid Build Coastguard Worker<tr><th>requested skeleton</th>
714*912701f9SAndroid Build Coastguard Worker    <th>set 1:<br/>
715*912701f9SAndroid Build Coastguard Worker        ...id="H"&gt;H&lt;/date...<br/>
716*912701f9SAndroid Build Coastguard Worker        ...id="h"&gt;h a&lt;/date...</th>
717*912701f9SAndroid Build Coastguard Worker    <th>set 2:<br/>
718*912701f9SAndroid Build Coastguard Worker        ...id="H"&gt;H&lt;/date...<br/>
719*912701f9SAndroid Build Coastguard Worker        ...id="h"&gt;h a&lt;/date...<br/>
720*912701f9SAndroid Build Coastguard Worker        ...id="Bh"&gt;B h&lt;/date...</th></tr>
721*912701f9SAndroid Build Coastguard Worker<tr><td>"h" (or "ah")</td><td>"h a"</td><td>"h a"</td></tr><tr><td>"bh"</td><td>"h b"</td><td>"h b"</td></tr>
722*912701f9SAndroid Build Coastguard Worker<tr><td>"Bh"</td><td>"h B"</td><td>"B h"</td></tr><tr><td>"H" (or "aH", "bH", "BH")</td><td>"H"</td><td>"H"</td></tr>
723*912701f9SAndroid Build Coastguard Worker</tbody></table>
724*912701f9SAndroid Build Coastguard Worker
725*912701f9SAndroid Build Coastguard WorkerThe hour input skeleton symbols 'j', 'J', and 'C' can be used to select the best hour format (h, H, …) before processing, and the appropriate dayperiod format (a, b, B) after a successful match that contains an 'a' symbol.
726*912701f9SAndroid Build Coastguard Worker
727*912701f9SAndroid Build Coastguard WorkerThe dateFormatItems inherit from their parent locale, so the inherited items need to be considered when processing.
728*912701f9SAndroid Build Coastguard Worker
729*912701f9SAndroid Build Coastguard Worker##### <a name="Matching_Skeletons" href="#Matching_Skeletons">Matching Skeletons</a>
730*912701f9SAndroid Build Coastguard Worker
731*912701f9SAndroid Build Coastguard WorkerIt is not necessary to supply `dateFormatItem`s with skeletons for every field length; fields in the skeleton and pattern are expected to be adjusted in parallel to handle a request.
732*912701f9SAndroid Build Coastguard Worker
733*912701f9SAndroid Build Coastguard WorkerTypically a “best match” from requested skeleton to the `id` portion of a `dateFormatItem` is found using a closest distance match, such as:
734*912701f9SAndroid Build Coastguard Worker
735*912701f9SAndroid Build Coastguard Worker1. Skeleton symbols requesting a best choice for the locale are replaced.
736*912701f9SAndroid Build Coastguard Worker   * j → one of {H, k, h, K}; C → one of {a, b, B}
737*912701f9SAndroid Build Coastguard Worker
738*912701f9SAndroid Build Coastguard Worker2. For skeleton and `id` fields with symbols representing the same type (year, month, day, etc):
739*912701f9SAndroid Build Coastguard Worker   1. Most symbols have a small distance from each other.
740*912701f9SAndroid Build Coastguard Worker      * M ≅ L; E ≅ c; a ≅ b ≅ B; H ≅ k ≅ h ≅ K; ...
741*912701f9SAndroid Build Coastguard Worker   2. Width differences among fields, other than those marking text vs numeric, are given small distance from each other.
742*912701f9SAndroid Build Coastguard Worker      * MMM ≅ MMMM
743*912701f9SAndroid Build Coastguard Worker      * MM ≅ M
744*912701f9SAndroid Build Coastguard Worker   3. Numeric and text fields are given a larger distance from each other.
745*912701f9SAndroid Build Coastguard Worker      * MMM ≈ MM
746*912701f9SAndroid Build Coastguard Worker   4. Symbols representing substantial differences (week of year vs week of month) are given a much larger distance from each other.
747*912701f9SAndroid Build Coastguard Worker      * d ≋ D; ...
748*912701f9SAndroid Build Coastguard Worker
749*912701f9SAndroid Build Coastguard Worker3. A requested skeleton that includes both seconds and fractional seconds (e.g. “mmssSSS”) is allowed to match a dateFormatItem skeleton that includes seconds but not fractional seconds (e.g. “ms”). In this case the requested sequence of ‘S’ characters (or its length) should be retained separately and used when adjusting the pattern, as described below.
750*912701f9SAndroid Build Coastguard Worker
751*912701f9SAndroid Build Coastguard Worker4. Otherwise, missing or extra fields between requested skeleton and `id` cause a match to fail. (But see **[Missing Skeleton Fields](#Missing_Skeleton_Fields)** below.)
752*912701f9SAndroid Build Coastguard Worker
753*912701f9SAndroid Build Coastguard WorkerOnce a best match is found between requested skeleton and `dateFormatItem` `id`, the corresponding `dateFormatItem` pattern is used, but with adjustments primarily to make the pattern field lengths match the skeleton field lengths. However, the pattern field lengths should not be matched in some cases:
754*912701f9SAndroid Build Coastguard Worker
755*912701f9SAndroid Build Coastguard Worker1. When the best-match `dateFormatItem` has an alphabetic field (such as MMM or MMMM) that corresponds to a numeric field in the pattern (such as M or MM), that numeric field in the pattern should _not_ be adjusted to match the skeleton length, and vice versa; i.e. adjustments should _never_ convert a numeric element in the pattern to an alphabetic element, or the opposite. See the second set of examples below.
756*912701f9SAndroid Build Coastguard Worker
757*912701f9SAndroid Build Coastguard Worker2. When the pattern field corresponds to an availableFormats skeleton with a field length that matches the field length in the requested skeleton, the pattern field length should _not_ be adjusted. This permits locale data to override a requested field length; see the third example below.
758*912701f9SAndroid Build Coastguard Worker
759*912701f9SAndroid Build Coastguard Worker3. Pattern field lengths for hour, minute, and second should by default not be adjusted to match the requested field length (i.e. locale data takes priority). However APIs that map skeletons to patterns should provide the option to override this behavior for cases when a client really does want to force a specific pattern field length.
760*912701f9SAndroid Build Coastguard Worker
761*912701f9SAndroid Build Coastguard Worker---
762*912701f9SAndroid Build Coastguard Worker
763*912701f9SAndroid Build Coastguard WorkerFor an example of general behavior, consider the following `dateFormatItem`:
764*912701f9SAndroid Build Coastguard Worker
765*912701f9SAndroid Build Coastguard Worker```xml
766*912701f9SAndroid Build Coastguard Worker<dateFormatItem id="yMMMd">d MMM y</dateFormatItem>
767*912701f9SAndroid Build Coastguard Worker```
768*912701f9SAndroid Build Coastguard Worker
769*912701f9SAndroid Build Coastguard WorkerIf this is the best match for yMMMMd, the pattern is automatically expanded to produce a pattern "d MMMM y" in response to the request. Of course, if the desired behavior is that a request for yMMMMd should produce something _other_ than "d MMMM y", a separate `dateFormatItem` must be present, for example:
770*912701f9SAndroid Build Coastguard Worker
771*912701f9SAndroid Build Coastguard Worker```xml
772*912701f9SAndroid Build Coastguard Worker<dateFormatItem id="yMMMMd">d 'de' MMMM 'de' y</dateFormatItem>
773*912701f9SAndroid Build Coastguard Worker```
774*912701f9SAndroid Build Coastguard Worker
775*912701f9SAndroid Build Coastguard Worker---
776*912701f9SAndroid Build Coastguard Worker
777*912701f9SAndroid Build Coastguard WorkerFor an example of not converting a pattern fields between numeric and alphabetic (point 1 above), consider the following `dateFormatItem`:
778*912701f9SAndroid Build Coastguard Worker
779*912701f9SAndroid Build Coastguard Worker```xml
780*912701f9SAndroid Build Coastguard Worker<dateFormatItem id="yMMM">y年M月</dateFormatItem>
781*912701f9SAndroid Build Coastguard Worker```
782*912701f9SAndroid Build Coastguard Worker
783*912701f9SAndroid Build Coastguard WorkerIf this is the best match for a requested skeleton yMMMM, automatic expansion should not produce a corresponding pattern “y年MMMM月”; rather, since “y年M月” specifies a numeric month M, automatic expansion should not modify the pattern, and should produce “y年M月” as the match for requested skeleton yMMMM.
784*912701f9SAndroid Build Coastguard Worker
785*912701f9SAndroid Build Coastguard Worker---
786*912701f9SAndroid Build Coastguard Worker
787*912701f9SAndroid Build Coastguard WorkerFor an example of not converting a pattern field length if the corresponding skeleton field matches the requested field length (point 2 above), consider the following `dateFormatItem`:
788*912701f9SAndroid Build Coastguard Worker
789*912701f9SAndroid Build Coastguard Worker```xml
790*912701f9SAndroid Build Coastguard Worker<dateFormatItem id="MMMEd">E, d בMMMM</dateFormatItem>
791*912701f9SAndroid Build Coastguard Worker```
792*912701f9SAndroid Build Coastguard Worker
793*912701f9SAndroid Build Coastguard WorkerFor Hebrew calendar date formats in the Hebrew locale, only the full month names should be used, even if abbreviated months are requested. Hence the `dateFormatItem` maps a request for abbreviated months to a pattern with full months. The same `dateFormatItem` can be expanded to expanded to match a request for “MMMMEd” to the same pattern.
794*912701f9SAndroid Build Coastguard Worker
795*912701f9SAndroid Build Coastguard Worker---
796*912701f9SAndroid Build Coastguard Worker
797*912701f9SAndroid Build Coastguard WorkerFinally: If the requested skeleton included both seconds and fractional seconds and the dateFormatItem skeleton included seconds but not fractional seconds, then the seconds field of the corresponding pattern should be adjusted by appending the locale’s decimal separator, followed by the sequence of ‘S’ characters from the requested skeleton.
798*912701f9SAndroid Build Coastguard Worker
799*912701f9SAndroid Build Coastguard Worker##### <a name="Missing_Skeleton_Fields" href="#Missing_Skeleton_Fields">Missing Skeleton Fields</a>
800*912701f9SAndroid Build Coastguard Worker
801*912701f9SAndroid Build Coastguard WorkerIf a client-requested set of fields includes both date and time fields, and if the `availableFormats` data does not include a `dateFormatItem` whose skeleton matches the same set of fields, then the request should be handled as follows:
802*912701f9SAndroid Build Coastguard Worker
803*912701f9SAndroid Build Coastguard Worker1. Divide the request into a date fields part and a time fields part.
804*912701f9SAndroid Build Coastguard Worker2. For each part, find the matching `dateFormatItem`, and expand the pattern as above.
805*912701f9SAndroid Build Coastguard Worker3. Combine the patterns for the two `dateFormatItem`s using the appropriate dateTimeFormat pattern, determined as follows from the requested date fields:
806*912701f9SAndroid Build Coastguard Worker   * If the requested date fields include wide month (MMMM, LLLL) and weekday name of any length (e.g. E, EEEE, c, cccc), use `<dateTimeFormatLength type="full">`
807*912701f9SAndroid Build Coastguard Worker   * Otherwise, if the requested date fields include wide month, use `<dateTimeFormatLength type="long">`
808*912701f9SAndroid Build Coastguard Worker   * Otherwise, if the requested date fields include abbreviated month (MMM, LLL), use `<dateTimeFormatLength type="medium">`
809*912701f9SAndroid Build Coastguard Worker   * Otherwise use `<dateTimeFormatLength type="short">`
810*912701f9SAndroid Build Coastguard Worker
811*912701f9SAndroid Build Coastguard Worker```xml
812*912701f9SAndroid Build Coastguard Worker<!ELEMENT appendItems (alias | (appendItem*, special*))>
813*912701f9SAndroid Build Coastguard Worker<!ELEMENT appendItem ( #PCDATA ) >
814*912701f9SAndroid Build Coastguard Worker<!ATTLIST appendItem request CDATA >
815*912701f9SAndroid Build Coastguard Worker```
816*912701f9SAndroid Build Coastguard Worker
817*912701f9SAndroid Build Coastguard WorkerIn case the best match does not include all the requested calendar fields, the `appendItems` element describes how to append needed fields to one of the existing formats. Each `appendItem` element covers a single calendar field. In the pattern, {0} represents the format string, {1} the data content of the field, and {2} the display name of the field (see [Calendar Fields](#Calendar_Fields)).
818*912701f9SAndroid Build Coastguard Worker
819*912701f9SAndroid Build Coastguard Worker#### <a name="intervalFormats" href="#intervalFormats">Element intervalFormats</a>
820*912701f9SAndroid Build Coastguard Worker
821*912701f9SAndroid Build Coastguard Worker```xml
822*912701f9SAndroid Build Coastguard Worker<!ELEMENT intervalFormats (alias | (intervalFormatFallback*, intervalFormatItem*, special*)) >
823*912701f9SAndroid Build Coastguard Worker
824*912701f9SAndroid Build Coastguard Worker<!ELEMENT intervalFormatFallback ( #PCDATA ) >
825*912701f9SAndroid Build Coastguard Worker
826*912701f9SAndroid Build Coastguard Worker<!ELEMENT intervalFormatItem (alias | (greatestDifference*, special*)) >
827*912701f9SAndroid Build Coastguard Worker<!ATTLIST intervalFormatItem id NMTOKEN #REQUIRED >
828*912701f9SAndroid Build Coastguard Worker
829*912701f9SAndroid Build Coastguard Worker<!ELEMENT greatestDifference ( #PCDATA ) >
830*912701f9SAndroid Build Coastguard Worker<!ATTLIST greatestDifference id NMTOKEN #REQUIRED >
831*912701f9SAndroid Build Coastguard Worker```
832*912701f9SAndroid Build Coastguard Worker
833*912701f9SAndroid Build Coastguard WorkerInterval formats allow for software to format intervals like "Jan 10-12, 2008" as a shorter and more natural format than "Jan 10, 2008 - Jan 12, 2008". They are designed to take a "skeleton" pattern (like the one used in availableFormats) plus start and end datetime, and use that information to produce a localized format.
834*912701f9SAndroid Build Coastguard Worker
835*912701f9SAndroid Build Coastguard WorkerThe data supplied in CLDR requires the software to determine the calendar field with the greatest difference before using the format pattern. For example, the greatest difference in "Jan 10-12, 2008" is the day field, while the greatest difference in "Jan 10 - Feb 12, 2008" is the month field. This is used to pick the exact pattern.
836*912701f9SAndroid Build Coastguard Worker
837*912701f9SAndroid Build Coastguard WorkerThe pattern is then designed to be broken up into two pieces by determining the first repeating field. For example, "MMM d-d, y" would be broken up into "MMM d-" and "d, y". The two parts are formatted with the first and second datetime, as described in more detail below.
838*912701f9SAndroid Build Coastguard Worker
839*912701f9SAndroid Build Coastguard WorkerFor the purposes of determining a repeating field, standalone fields and format fields are considered equivalent. For example, given the pattern "LLL d - MMM d, Y", the repeating field would be "M" since standalone month field "L" is considered equivalent to format field "M" when determining the repeating field. Therefore the pattern would be broken up into "LLL d - " and "MMM d, Y".
840*912701f9SAndroid Build Coastguard Worker
841*912701f9SAndroid Build Coastguard WorkerIn case there is no matching pattern, the intervalFormatFallback defines the fallback pattern. The fallback pattern is of the form "{0} - {1}" or "{1} - {0}", where {0} is replaced by the start datetime, and {1} is replaced by the end datetime. The fallback pattern determines the default order of the interval pattern. "{0} - {1}" means the first part of the interval patterns in current local are formatted with the start datetime, while "{1} - {0}" means the first part of the interval patterns in current locale are formatted with the end datetime.
842*912701f9SAndroid Build Coastguard Worker
843*912701f9SAndroid Build Coastguard WorkerThe `id` attribute of intervalFormatItem is the "skeleton" pattern (like the one used in availableFormats) on which the format pattern is based. The `id` attribute of `greatestDifference` is the calendar field letter, for example 'M', which is the greatest difference between start and end datetime.
844*912701f9SAndroid Build Coastguard Worker
845*912701f9SAndroid Build Coastguard WorkerThe greatest difference defines a specific interval pattern of start and end datetime on a "skeleton" and a greatestDifference. As stated above, the interval pattern is designed to be broken up into two pieces. Each piece is similar to the pattern defined in date format. Also, each interval pattern could override the default order defined in fallback pattern. If an interval pattern starts with "latestFirst:", the first part of this particular interval pattern is formatted with the end datetime. If an interval pattern starts with "earliestFirst:", the first part of this particular interval pattern is formatted with the start datetime. Otherwise, the order is the same as the order defined in `intervalFormatFallback`.
846*912701f9SAndroid Build Coastguard Worker
847*912701f9SAndroid Build Coastguard WorkerFor example, the English rules that produce "Jan 10–12, 2008", "Jan 10 – Feb 12, 2008", and "Jan 10, 2008 – Feb. 12, 2009" are as follows:
848*912701f9SAndroid Build Coastguard Worker
849*912701f9SAndroid Build Coastguard Worker```xml
850*912701f9SAndroid Build Coastguard Worker<intervalFormatItem id="yMMMd">
851*912701f9SAndroid Build Coastguard Worker    <greatestDifference id="M">MMM d – MMM d, yyyy</greatestDifference>
852*912701f9SAndroid Build Coastguard Worker    <greatestDifference id="d">MMM d–d, yyyy</greatestDifference>
853*912701f9SAndroid Build Coastguard Worker    <greatestDifference id="y">MMM d, yyyy – MMM d, yyyy</greatestDifference>
854*912701f9SAndroid Build Coastguard Worker</intervalFormatItem>
855*912701f9SAndroid Build Coastguard Worker```
856*912701f9SAndroid Build Coastguard Worker
857*912701f9SAndroid Build Coastguard WorkerTo format a start and end datetime, given a particular "skeleton":
858*912701f9SAndroid Build Coastguard Worker
859*912701f9SAndroid Build Coastguard Worker1. Look for the `intervalFormatItem` element that matches the "skeleton", starting in the current locale and then following the locale fallback chain up to, but not including root (better results are obtained by following steps 2-6 below with locale- or language-specific data than by using matching intervalFormats from root).
860*912701f9SAndroid Build Coastguard Worker2. If no match was found from the previous step, check what the closest match is in the fallback locale chain, as in `availableFormats`. That is, this allows for adjusting the string value field's width, including adjusting between "MMM" and "MMMM", and using different variants of the same field, such as 'v' and 'z'.
861*912701f9SAndroid Build Coastguard Worker3. If no match was found from the previous steps and the skeleton combines date fields such as y,M,d with time fields such as H,h,m,s, then an `intervalFormatItem` can be synthesized as follows:
862*912701f9SAndroid Build Coastguard Worker   1. For `greatestDifference` values corresponding to the date fields in the skeleton, use the mechanisms described under [availableFormats](#availableFormats_appendItems) to generate the complete date-time pattern corresponding to the skeleton, and then combine two such patterns using the `intervalFormatFallback` pattern (the result will be the same for each `greatestDifference` of a day or longer). For example:
863*912701f9SAndroid Build Coastguard Worker      MMMdHm/d → "MMM d 'at' H:mm – MMM d 'at' H:mm" → "Jan 3 at 9:00 – Jan 6 at 11:00"
864*912701f9SAndroid Build Coastguard Worker   2. For `greatestDifference` values corresponding to the time fields in the skeleton, separate the skeleton into a date fields part and a time fields part. Use the mechanisms described under availableFormats to generate a date pattern corresponding to the date fields part. Use the time fields part to look up an `intervalFormatItem`. For each `greatestDifference` in the `intervalFormatItem`, generate a pattern by using the [dateTimeFormat](#dateTimeFormat) to combine the date pattern with the `intervalFormatItem`’s `greatestDifference` element value. For example:
865*912701f9SAndroid Build Coastguard Worker      MMMdHm/H → "MMM d 'at' H:mm – H:mm" → "Jan 3 at 9:00 – 11:00"
866*912701f9SAndroid Build Coastguard Worker4. If a match is found from previous steps, compute the calendar field with the greatest difference between start and end datetime. If there is no difference among any of the fields in the pattern, format as a single date using `availableFormats`, and return.
867*912701f9SAndroid Build Coastguard Worker5. Otherwise, look for `greatestDifference` element that matches this particular greatest difference.
868*912701f9SAndroid Build Coastguard Worker6. If there is a match, use the pieces of the corresponding pattern to format the start and end datetime, as above.
869*912701f9SAndroid Build Coastguard Worker7. Otherwise, format the start and end datetime using the fallback pattern.
870*912701f9SAndroid Build Coastguard Worker
871*912701f9SAndroid Build Coastguard Worker## <a name="Calendar_Fields" href="#Calendar_Fields">Calendar Fields</a>
872*912701f9SAndroid Build Coastguard Worker
873*912701f9SAndroid Build Coastguard Worker```xml
874*912701f9SAndroid Build Coastguard Worker<!ELEMENT fields ( alias | (field*, special*)) >
875*912701f9SAndroid Build Coastguard Worker<!ELEMENT field ( alias | (displayName*, relative*, relativeTime*, relativePeriod*, special*)) >
876*912701f9SAndroid Build Coastguard Worker<!ATTLIST field type ( era | era-short | era-narrow | year | year-short | year-narrow | quarter | quarter-short | quarter-narrow | month | month-short | month-narrow | week | week-short | week-narrow | weekOfMonth | weekOfMonth-short | weekOfMonth-narrow | day | day-short | day-narrow | dayOfYear | dayOfYear-short | dayOfYear-narrow | weekday | weekday-short | weekday-narrow | weekdayOfMonth | weekdayOfMonth-short | weekdayOfMonth-narrow | sun | sun-short | sun-narrow | mon | mon-short | mon-narrow | tue | tue-short | tue-narrow | wed | wed-short | wed-narrow | thu | thu-short | thu-narrow | fri | fri-short | fri-narrow | sat | sat-short | sat-narrow | dayperiod | dayperiod-short | dayperiod-narrow | hour | hour-short | hour-narrow | minute | minute-short | minute-narrow | second | second-short | second-narrow | zone | zone-short | zone-narrow ) #IMPLIED >
877*912701f9SAndroid Build Coastguard Worker
878*912701f9SAndroid Build Coastguard Worker<!ELEMENT relative (#PCDATA) >
879*912701f9SAndroid Build Coastguard Worker<!ATTLIST relative type NMTOKEN #IMPLIED >
880*912701f9SAndroid Build Coastguard Worker
881*912701f9SAndroid Build Coastguard Worker<!ELEMENT relativeTime ( alias | (relativeTimePattern*, special*)) >
882*912701f9SAndroid Build Coastguard Worker<!ATTLIST relativeTime type NMTOKEN #REQUIRED >
883*912701f9SAndroid Build Coastguard Worker
884*912701f9SAndroid Build Coastguard Worker<!ELEMENT relativeTimePattern ( #PCDATA ) >
885*912701f9SAndroid Build Coastguard Worker<!ATTLIST relativeTimePattern count ( zero | one | two | few | many | other ) #REQUIRED >
886*912701f9SAndroid Build Coastguard Worker
887*912701f9SAndroid Build Coastguard Worker<!ELEMENT relativePeriod (#PCDATA) >
888*912701f9SAndroid Build Coastguard Worker```
889*912701f9SAndroid Build Coastguard Worker
890*912701f9SAndroid Build Coastguard WorkerTranslations may be supplied for names of calendar fields (elements of a calendar, such as Day, Month, Year, Hour, and so on), and for relative values for those fields (for example, the day with relative value -1 is "Yesterday"). There are four types of translations; some are only relevant or useful for certain types of fields:
891*912701f9SAndroid Build Coastguard Worker
892*912701f9SAndroid Build Coastguard Worker* `<displayName>` General display name for the field type. This should be relevant for all elements, including those like era and zone that might not have useful forms for the other name types. These are typically presented in titlecase (eg “Day”) since they are intended as labels in a UI.
893*912701f9SAndroid Build Coastguard Worker* `<relative>` Display names for the current instance of the field, and one or two past and future instances. In English, data is provided for year, quarter, month, week, day, specific days of the week (sun, mon, tue, …), and—with offset 0 only—for hour, minute, and second.
894*912701f9SAndroid Build Coastguard Worker* `<relativeTime>` Display names for an instance of the field that is a counted number of units in the past or the future relative to the current instance; this needs plural forms. In English, data is provided for year, quarter, month, week, day, specific days of the week, hour, minute, and second.
895*912701f9SAndroid Build Coastguard Worker* `<relativePeriod>` Pattern for designating an instance of the specified field in relation to some other date reference. This is currently only used for weeks, and provides a pattern such as “the week of {0}” which can be used to generate designations such as “the week of April 11, 2016” or “the week of April 11–15”.
896*912701f9SAndroid Build Coastguard Worker
897*912701f9SAndroid Build Coastguard WorkerWhere there is not a convenient, customary word or phrase in a particular language for a particular type of relative value, it should be omitted.
898*912701f9SAndroid Build Coastguard Worker
899*912701f9SAndroid Build Coastguard WorkerExamples, first for English:
900*912701f9SAndroid Build Coastguard Worker
901*912701f9SAndroid Build Coastguard Worker```xml
902*912701f9SAndroid Build Coastguard Worker<fields>
903*912701f9SAndroid Build Coastguard Worker904*912701f9SAndroid Build Coastguard Worker    <field type="day">
905*912701f9SAndroid Build Coastguard Worker        <displayName>Day</displayName>
906*912701f9SAndroid Build Coastguard Worker        <relative type="-1">yesterday</relative>
907*912701f9SAndroid Build Coastguard Worker        <relative type="0">today</relative>
908*912701f9SAndroid Build Coastguard Worker        <relative type="1">tomorrow</relative>
909*912701f9SAndroid Build Coastguard Worker        <relativeTime type="future">
910*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="one">in {0} day</relativeTimePattern>
911*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="other">in {0} days</relativeTimePattern>
912*912701f9SAndroid Build Coastguard Worker        </relativeTime>
913*912701f9SAndroid Build Coastguard Worker        <relativeTime type="past">
914*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="one">{0} day ago</relativeTimePattern>
915*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="other">{0} days ago</relativeTimePattern>
916*912701f9SAndroid Build Coastguard Worker        </relativeTime>
917*912701f9SAndroid Build Coastguard Worker    </field>
918*912701f9SAndroid Build Coastguard Worker    <field type="weekday">
919*912701f9SAndroid Build Coastguard Worker        <displayName>Day of the Week</displayName>
920*912701f9SAndroid Build Coastguard Worker    </field>
921*912701f9SAndroid Build Coastguard Worker    <field type="sun">
922*912701f9SAndroid Build Coastguard Worker        <relative type="-1">last Sunday</relative>
923*912701f9SAndroid Build Coastguard Worker        <relative type="0">this Sunday</relative>
924*912701f9SAndroid Build Coastguard Worker        <relative type="1">next Sunday</relative>
925*912701f9SAndroid Build Coastguard Worker        <relativeTime type="future">
926*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="one">in {0} Sunday</relativeTimePattern>
927*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="other">in {0} Sundays</relativeTimePattern>
928*912701f9SAndroid Build Coastguard Worker        </relativeTime>
929*912701f9SAndroid Build Coastguard Worker        <relativeTime type="past">
930*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="one">{0} Sunday ago</relativeTimePattern>
931*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="other">{0} Sundays ago</relativeTimePattern>
932*912701f9SAndroid Build Coastguard Worker        </relativeTime>
933*912701f9SAndroid Build Coastguard Worker    </field>
934*912701f9SAndroid Build Coastguard Worker935*912701f9SAndroid Build Coastguard Worker    <field type="hour">
936*912701f9SAndroid Build Coastguard Worker        <displayName>Hour</displayName>
937*912701f9SAndroid Build Coastguard Worker        <relative type="0">now</relative>
938*912701f9SAndroid Build Coastguard Worker        <relativeTime type="future">
939*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="one">in {0} hour</relativeTimePattern>
940*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="other">in {0} hours</relativeTimePattern>
941*912701f9SAndroid Build Coastguard Worker        </relativeTime>
942*912701f9SAndroid Build Coastguard Worker        <relativeTime type="past">
943*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="one">{0} hour ago</relativeTimePattern>
944*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="other">{0} hours ago</relativeTimePattern>
945*912701f9SAndroid Build Coastguard Worker        </relativeTime>
946*912701f9SAndroid Build Coastguard Worker    </field>
947*912701f9SAndroid Build Coastguard Worker948*912701f9SAndroid Build Coastguard Worker</fields>
949*912701f9SAndroid Build Coastguard Worker
950*912701f9SAndroid Build Coastguard Worker```
951*912701f9SAndroid Build Coastguard Worker
952*912701f9SAndroid Build Coastguard WorkerSecond, for German; includes relative type="-2"/"2", present in the English example:
953*912701f9SAndroid Build Coastguard Worker
954*912701f9SAndroid Build Coastguard Worker```xml
955*912701f9SAndroid Build Coastguard Worker<fields>
956*912701f9SAndroid Build Coastguard Worker957*912701f9SAndroid Build Coastguard Worker    <field type="day">
958*912701f9SAndroid Build Coastguard Worker        <displayName>Tag</displayName>
959*912701f9SAndroid Build Coastguard Worker        <relative type="-2">Vorgestern</relative>
960*912701f9SAndroid Build Coastguard Worker        <relative type="-1">Gestern</relative>
961*912701f9SAndroid Build Coastguard Worker        <relative type="0">Heute</relative>
962*912701f9SAndroid Build Coastguard Worker        <relative type="1">Morgen</relative>
963*912701f9SAndroid Build Coastguard Worker        <relative type="2">Übermorgen</relative>
964*912701f9SAndroid Build Coastguard Worker        <relativeTime type="future">
965*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="one">In {0} Tag</relativeTimePattern>
966*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="other">In {0} Tagen</relativeTimePattern>
967*912701f9SAndroid Build Coastguard Worker        </relativeTime>
968*912701f9SAndroid Build Coastguard Worker        <relativeTime type="past">
969*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="one">Vor {0} Tag</relativeTimePattern>
970*912701f9SAndroid Build Coastguard Worker            <relativeTimePattern count="other">Vor {0} Tagen</relativeTimePattern>
971*912701f9SAndroid Build Coastguard Worker        </relativeTime>
972*912701f9SAndroid Build Coastguard Worker    </field>
973*912701f9SAndroid Build Coastguard Worker974*912701f9SAndroid Build Coastguard Worker</fields>
975*912701f9SAndroid Build Coastguard Worker```
976*912701f9SAndroid Build Coastguard Worker
977*912701f9SAndroid Build Coastguard WorkerA special name for “now” is indicated using `<relative type="0">` for the "second" field. For example, in English:
978*912701f9SAndroid Build Coastguard Worker
979*912701f9SAndroid Build Coastguard Worker```xml
980*912701f9SAndroid Build Coastguard Worker<field type="second">
981*912701f9SAndroid Build Coastguard Worker    <displayName>Second</displayName>
982*912701f9SAndroid Build Coastguard Worker    <relative type="0">now</relative>
983*912701f9SAndroid Build Coastguard Worker984*912701f9SAndroid Build Coastguard Worker</field>
985*912701f9SAndroid Build Coastguard Worker```
986*912701f9SAndroid Build Coastguard Worker
987*912701f9SAndroid Build Coastguard WorkerDifferent widths can be supplied for certain fields, such as:
988*912701f9SAndroid Build Coastguard Worker
989*912701f9SAndroid Build Coastguard Worker```xml
990*912701f9SAndroid Build Coastguard Worker<field type="year-short">
991*912701f9SAndroid Build Coastguard Worker    <displayName>yr.</displayName>
992*912701f9SAndroid Build Coastguard Worker    <relative type="-1">last yr.</relative>
993*912701f9SAndroid Build Coastguard Worker    <relative type="0">this yr.</relative>
994*912701f9SAndroid Build Coastguard Worker    <relative type="1">next yr.</relative>
995*912701f9SAndroid Build Coastguard Worker    <relativeTime type="future">
996*912701f9SAndroid Build Coastguard Worker        <relativeTimePattern count="one">in {0} yr.</relativeTimePattern>
997*912701f9SAndroid Build Coastguard Worker        <relativeTimePattern count="other">in {0} yr.</relativeTimePattern>
998*912701f9SAndroid Build Coastguard Worker    </relativeTime>
999*912701f9SAndroid Build Coastguard Worker    <relativeTime type="past">
1000*912701f9SAndroid Build Coastguard Worker        <relativeTimePattern count="one">{0} yr. ago</relativeTimePattern>
1001*912701f9SAndroid Build Coastguard Worker        <relativeTimePattern count="other">{0} yr. ago</relativeTimePattern>
1002*912701f9SAndroid Build Coastguard Worker    </relativeTime>
1003*912701f9SAndroid Build Coastguard Worker</field>
1004*912701f9SAndroid Build Coastguard Worker```
1005*912701f9SAndroid Build Coastguard Worker
1006*912701f9SAndroid Build Coastguard WorkerAs in other cases, **narrow** may be ambiguous out of context.
1007*912701f9SAndroid Build Coastguard Worker
1008*912701f9SAndroid Build Coastguard Worker## <a name="Supplemental_Calendar_Data" href="#Supplemental_Calendar_Data">Supplemental Calendar Data</a>
1009*912701f9SAndroid Build Coastguard Worker
1010*912701f9SAndroid Build Coastguard Worker### <a name="Calendar_Data" href="#Calendar_Data">Calendar Data</a>
1011*912701f9SAndroid Build Coastguard Worker
1012*912701f9SAndroid Build Coastguard Worker```xml
1013*912701f9SAndroid Build Coastguard Worker<!ELEMENT calendarData ( calendar* )>
1014*912701f9SAndroid Build Coastguard Worker<!ELEMENT calendar ( calendarSystem?, inheritEras?, eras? )>
1015*912701f9SAndroid Build Coastguard Worker<!ATTLIST calendar type NMTOKENS #REQUIRED>
1016*912701f9SAndroid Build Coastguard Worker<!ATTLIST calendar territories NMTOKENS #IMPLIED > <!-- deprecated, replaced by calendarPreferenceData -->
1017*912701f9SAndroid Build Coastguard Worker
1018*912701f9SAndroid Build Coastguard Worker<!ELEMENT calendarSystem EMPTY>
1019*912701f9SAndroid Build Coastguard Worker<!ATTLIST calendarSystem type (solar | lunar | lunisolar | other) #REQUIRED>
1020*912701f9SAndroid Build Coastguard Worker
1021*912701f9SAndroid Build Coastguard Worker<!ELEMENT inheritEras EMPTY >
1022*912701f9SAndroid Build Coastguard Worker<!ATTLIST inheritEras calendar NMTOKEN #REQUIRED >
1023*912701f9SAndroid Build Coastguard Worker
1024*912701f9SAndroid Build Coastguard Worker<!ELEMENT eras ( era* )>
1025*912701f9SAndroid Build Coastguard Worker
1026*912701f9SAndroid Build Coastguard Worker<!ELEMENT era EMPTY>
1027*912701f9SAndroid Build Coastguard Worker<!ATTLIST era type NMTOKENS #REQUIRED>
1028*912701f9SAndroid Build Coastguard Worker<!ATTLIST era start CDATA #IMPLIED>
1029*912701f9SAndroid Build Coastguard Worker<!ATTLIST era end CDATA #IMPLIED>
1030*912701f9SAndroid Build Coastguard Worker<!ATTLIST era code NMTOKEN #IMPLIED >
1031*912701f9SAndroid Build Coastguard Worker<!ATTLIST era aliases NMTOKENS #IMPLIED >
1032*912701f9SAndroid Build Coastguard Worker```
1033*912701f9SAndroid Build Coastguard Worker
1034*912701f9SAndroid Build Coastguard WorkerThe `<calendarData>` element now provides only locale-independent data about calendar behaviors via its `<calendar>` subelements, which for each calendar can specify the astronomical basis of the calendar (solar, lunar, etc.) and the date ranges for its eras.
1035*912701f9SAndroid Build Coastguard Worker
1036*912701f9SAndroid Build Coastguard WorkerEra start or end dates are specified in terms of the equivalent proleptic Gregorian date (in "y-M-d" format). Eras may be open-ended, with unspecified start or end dates. For example, here are the eras for the Gregorian calendar:
1037*912701f9SAndroid Build Coastguard Worker
1038*912701f9SAndroid Build Coastguard Worker```xml
1039*912701f9SAndroid Build Coastguard Worker<era type="0" end="0-12-31" code="gregory-inverse" aliases="bc bce"/>
1040*912701f9SAndroid Build Coastguard Worker<era type="1" start="1-01-01" code="gregory" aliases="ad ce"/>
1041*912701f9SAndroid Build Coastguard Worker```
1042*912701f9SAndroid Build Coastguard Worker
1043*912701f9SAndroid Build Coastguard WorkerFor a sequence of eras with specified start dates, the end of each era need not be explicitly specified (it is assumed to match the start of the subsequent era). For example, here are the first few eras for the Japanese calendar:
1044*912701f9SAndroid Build Coastguard Worker
1045*912701f9SAndroid Build Coastguard Worker```xml
1046*912701f9SAndroid Build Coastguard Worker<era type="0" start="645-6-19" />
1047*912701f9SAndroid Build Coastguard Worker<era type="1" start="650-2-15" />
1048*912701f9SAndroid Build Coastguard Worker<era type="2" start="672-1-1" />
1049*912701f9SAndroid Build Coastguard Worker1050*912701f9SAndroid Build Coastguard Worker```
1051*912701f9SAndroid Build Coastguard Worker
1052*912701f9SAndroid Build Coastguard WorkerSome eras have additional `code` and `aliases` attributes that define invariant strings for identifying the eras. The `code` is a single globally unique identifier, and `aliases` are space-separated identifiers unique within the calendar. The code and aliases follow the following rules:
1053*912701f9SAndroid Build Coastguard Worker
1054*912701f9SAndroid Build Coastguard Worker1. Every calendar has either an era with a `code` that is the same as the BCP-47 name of that calendar or an `inheritEras` element pointing to another calendar with such an era. This era should be used for anchoring the "extended year" in the calendar (`u` in the date format pattern).
1055*912701f9SAndroid Build Coastguard Worker2. Eras that count backwards (larger numbers for older years) are suffixed with `-inverse`.
1056*912701f9SAndroid Build Coastguard Worker3. If the same era code is used in multiple calendars, then the calculations for year, month, and day in that era must be the same in all calendars in which it is used. For example, the `ethioaa` era is used in two calendar systems.
1057*912701f9SAndroid Build Coastguard Worker
1058*912701f9SAndroid Build Coastguard WorkerIf a `<calendar>` contains an `<inheritEras/>` element, all eras from the specified calendar should be inserted in order into the sequence of eras for the current calendar and follow the same start and end date rules. For example:
1059*912701f9SAndroid Build Coastguard Worker
1060*912701f9SAndroid Build Coastguard Worker```xml
1061*912701f9SAndroid Build Coastguard Worker<calendar type="japanese">
1062*912701f9SAndroid Build Coastguard Worker    <inheritEras calendar="gregorian" />
1063*912701f9SAndroid Build Coastguard Worker    <eras>
1064*912701f9SAndroid Build Coastguard Worker        <era type="0" start="645-6-19"/>
1065*912701f9SAndroid Build Coastguard Worker        <era type="1" start="650-2-15"/>
1066*912701f9SAndroid Build Coastguard Worker        <!-- ... -->
1067*912701f9SAndroid Build Coastguard Worker    </eras>
1068*912701f9SAndroid Build Coastguard Worker</calendar>
1069*912701f9SAndroid Build Coastguard Worker```
1070*912701f9SAndroid Build Coastguard Worker
1071*912701f9SAndroid Build Coastguard WorkerThis means that the two eras from calendar "gregorian" should be inserted into the era list for "japanese" for calculations and formatting.
1072*912701f9SAndroid Build Coastguard Worker
1073*912701f9SAndroid Build Coastguard Worker**Note:** The `territories` attribute in the `calendar` element is deprecated. It was formerly used to indicate calendar preference by territory, but this is now given by the _[Calendar Preference Data](#Calendar_Preference_Data)_ below.
1074*912701f9SAndroid Build Coastguard Worker
1075*912701f9SAndroid Build Coastguard Worker### <a name="Calendar_Preference_Data" href="#Calendar_Preference_Data">Calendar Preference Data</a>
1076*912701f9SAndroid Build Coastguard Worker
1077*912701f9SAndroid Build Coastguard Worker```xml
1078*912701f9SAndroid Build Coastguard Worker<!ELEMENT calendarPreferenceData ( calendarPreference* ) >
1079*912701f9SAndroid Build Coastguard Worker<!ELEMENT calendarPreference EMPTY >
1080*912701f9SAndroid Build Coastguard Worker<!ATTLIST calendarPreference territories NMTOKENS #REQUIRED >
1081*912701f9SAndroid Build Coastguard Worker<!ATTLIST calendarPreference ordering NMTOKENS #REQUIRED >
1082*912701f9SAndroid Build Coastguard Worker```
1083*912701f9SAndroid Build Coastguard Worker
1084*912701f9SAndroid Build Coastguard WorkerThe `calendarPreference` element provides a list of commonly used calendar types in a territory. The `ordering` attribute indicates the list of calendar types in preferred order. The first calendar type in the list is the default calendar type for the territory. For example:
1085*912701f9SAndroid Build Coastguard Worker
1086*912701f9SAndroid Build Coastguard Worker```xml
1087*912701f9SAndroid Build Coastguard Worker<calendarPreference territories="001" ordering="gregorian"/>
1088*912701f9SAndroid Build Coastguard Worker<calendarPreference territories="JP" ordering="gregorian japanese"/>
1089*912701f9SAndroid Build Coastguard Worker<calendarPreference territories="TH" ordering="buddhist gregorian"/>
1090*912701f9SAndroid Build Coastguard Worker```
1091*912701f9SAndroid Build Coastguard Worker
1092*912701f9SAndroid Build Coastguard WorkerThe `calendarPreference` elements above indicate:
1093*912701f9SAndroid Build Coastguard Worker
1094*912701f9SAndroid Build Coastguard Worker* The default (for territory "001") is that only the Gregorian calendar is commonly used.
1095*912701f9SAndroid Build Coastguard Worker* For Japan, the Gregorian and Japanese calendars are both used, with Gregorian preferred (the default).
1096*912701f9SAndroid Build Coastguard Worker* For Thailand, the Buddhist and Gregorian calendars are both used, and Buddhist is preferred (the default).
1097*912701f9SAndroid Build Coastguard Worker
1098*912701f9SAndroid Build Coastguard WorkerThe calendars in common use for a locale should typically be shown in UIs that provide a choice of calendars. (An 'Other...' button could give access to the other available calendars.)
1099*912701f9SAndroid Build Coastguard Worker
1100*912701f9SAndroid Build Coastguard Worker### <a name="Week_Data" href="#Week_Data">Week Data</a>
1101*912701f9SAndroid Build Coastguard Worker
1102*912701f9SAndroid Build Coastguard Worker```xml
1103*912701f9SAndroid Build Coastguard Worker<!ELEMENT weekData ( minDays*, firstDay*, weekendStart*, weekendEnd*, weekOfPreference* )>
1104*912701f9SAndroid Build Coastguard Worker
1105*912701f9SAndroid Build Coastguard Worker<!ELEMENT minDays EMPTY>
1106*912701f9SAndroid Build Coastguard Worker<!ATTLIST minDays count (1 | 2 | 3 | 4 | 5 | 6 | 7) #REQUIRED>
1107*912701f9SAndroid Build Coastguard Worker<!ATTLIST minDays territories NMTOKENS #REQUIRED>
1108*912701f9SAndroid Build Coastguard Worker
1109*912701f9SAndroid Build Coastguard Worker<!ELEMENT firstDay EMPTY >
1110*912701f9SAndroid Build Coastguard Worker<!ATTLIST firstDay day (sun | mon | tue | wed | thu | fri | sat) #REQUIRED>
1111*912701f9SAndroid Build Coastguard Worker<!ATTLIST firstDay territories NMTOKENS #REQUIRED>
1112*912701f9SAndroid Build Coastguard Worker
1113*912701f9SAndroid Build Coastguard Worker<!ELEMENT weekendStart EMPTY>
1114*912701f9SAndroid Build Coastguard Worker<!ATTLIST weekendStart day (sun | mon | tue | wed | thu | fri | sat) #REQUIRED>
1115*912701f9SAndroid Build Coastguard Worker<!ATTLIST weekendStart territories NMTOKENS #REQUIRED>
1116*912701f9SAndroid Build Coastguard Worker
1117*912701f9SAndroid Build Coastguard Worker<!ELEMENT weekendEnd EMPTY>
1118*912701f9SAndroid Build Coastguard Worker<!ATTLIST weekendEnd day (sun | mon | tue | wed | thu | fri | sat) #REQUIRED>
1119*912701f9SAndroid Build Coastguard Worker<!ATTLIST weekendEnd territories NMTOKENS #REQUIRED>
1120*912701f9SAndroid Build Coastguard Worker
1121*912701f9SAndroid Build Coastguard Worker<!ELEMENT weekOfPreference EMPTY>
1122*912701f9SAndroid Build Coastguard Worker<!ATTLIST weekOfPreference locales NMTOKENS #REQUIRED>
1123*912701f9SAndroid Build Coastguard Worker<!ATTLIST weekOfPreference ordering NMTOKENS #REQUIRED>
1124*912701f9SAndroid Build Coastguard Worker```
1125*912701f9SAndroid Build Coastguard Worker
1126*912701f9SAndroid Build Coastguard WorkerThese values provide territory-specific information needed for week-of-year and week-of-month calculations, as well as information on conventions for first day of the week, for weekends, and for week designations. For most elements, the default is provided by the element with `territories="001"`; for `weekOfPreference` elements the default is provided by the element with `locales="und"`.
1127*912701f9SAndroid Build Coastguard Worker
1128*912701f9SAndroid Build Coastguard Worker```xml
1129*912701f9SAndroid Build Coastguard Worker<weekData>
1130*912701f9SAndroid Build Coastguard Worker    <minDays count="1" territories="001" />
1131*912701f9SAndroid Build Coastguard Worker    <minDays count="4" territories="AD AN AT AX BE BG CH CZ DE DK EE ES FI FJ FO FR GB …" />
1132*912701f9SAndroid Build Coastguard Worker    <firstDay day="mon" territories="001" />
1133*912701f9SAndroid Build Coastguard Worker    <firstDay day="fri" territories="BD MV" />
1134*912701f9SAndroid Build Coastguard Worker    <firstDay day="sat" territories="AE AF BH DJ DZ EG IQ IR JO …" />
1135*912701f9SAndroid Build Coastguard Worker1136*912701f9SAndroid Build Coastguard Worker    <weekendStart day="sat" territories="001" />
1137*912701f9SAndroid Build Coastguard Worker    <weekendStart day="sun" territories="IN" />
1138*912701f9SAndroid Build Coastguard Worker    <weekendStart day="thu" territories="AF DZ IR OM SA YE" />
1139*912701f9SAndroid Build Coastguard Worker    <weekendStart day="fri" territories="AE BH EG IL IQ JO KW …" />
1140*912701f9SAndroid Build Coastguard Worker1141*912701f9SAndroid Build Coastguard Worker    <weekOfPreference ordering="weekOfYear" locales="und" />
1142*912701f9SAndroid Build Coastguard Worker    <weekOfPreference ordering="weekOfYear weekOfMonth" locales="am az bs cs cy da el et hi ky lt mk sk ta th" />
1143*912701f9SAndroid Build Coastguard Worker    <weekOfPreference ordering="weekOfYear weekOfMonth weekOfInterval" locales="is mn no sv vi" />
1144*912701f9SAndroid Build Coastguard Worker    <weekOfPreference ordering="weekOfYear weekOfDate weekOfMonth" locales="fi zh-TW" />
1145*912701f9SAndroid Build Coastguard Worker1146*912701f9SAndroid Build Coastguard Worker```
1147*912701f9SAndroid Build Coastguard Worker
1148*912701f9SAndroid Build Coastguard WorkerIn order for a week to count as the first week of a new year for week-of-year calculations, the week beginning with `firstDay` must include at least the number of days in the new year specified by the `minDays` value; otherwise the week will count as the last week of the previous year (and for week-of-month calculations, `minDays` also specifies the minimum number of days in the new month for a week to count as part of that month).
1149*912701f9SAndroid Build Coastguard Worker
1150*912701f9SAndroid Build Coastguard Worker> **Note:** For week-of-year calculations, Gregorian years may have 52 or 53 weeks. Changes in the value of `minDays` or `firstDay` can affect the year to which a date is assigned as well as the number of weeks in a given year; implementations that parse dates using week-of-year formats should be prepared to handle such cases. For example when parsing a date in week 53 of a year for which current values of `minDays` and `firstDay` no longer result in a 53-week year, that date should be treated as in the first week of the following year.
1151*912701f9SAndroid Build Coastguard Worker
1152*912701f9SAndroid Build Coastguard WorkerThe day indicated by `firstDay` is the one that should be shown as the first day of the week in a calendar view. This is not necessarily the same as the first day after the weekend (or the first work day of the week), which should be determined from the weekend information. Currently, day-of-week numbering is based on `firstDay` (that is, day 1 is the day specified by `firstDay`), but in the future we may add a way to specify this separately. The `firstDay` value determined from the region can be overridden by the locale keyword "fw", see [Unicode First Day Identifier](tr35.md#UnicodeFirstDayIdentifier).
1153*912701f9SAndroid Build Coastguard Worker
1154*912701f9SAndroid Build Coastguard WorkerWhat is meant by the weekend varies from country to country. It is typically when most non-retail businesses are closed. The time should not be specified unless it is a well-recognized part of the day. The `weekendStart` day defaults to "sat", and `weekendEnd` day defaults to "sun". For more information, see _[Dates and Date Ranges](tr35.md#Date_Ranges)_.
1155*912701f9SAndroid Build Coastguard Worker
1156*912701f9SAndroid Build Coastguard WorkerEach `weekOfPreference` element provides, for its specified locales, an ordered list of the preferred types of week designations for that set of locales. There are four types of week designations, each of which makes use of date patterns available in the locale, as follows:
1157*912701f9SAndroid Build Coastguard Worker
1158*912701f9SAndroid Build Coastguard Worker###### Table: <a name="Week_Designation_Types" href="#Week_Designation_Types">Week Designation Types</a>
1159*912701f9SAndroid Build Coastguard Worker
1160*912701f9SAndroid Build Coastguard Worker| Type           | Examples                          | Date Pattern                                                | Comments    |
1161*912701f9SAndroid Build Coastguard Worker|----------------|-----------------------------------|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
1162*912701f9SAndroid Build Coastguard Worker| weekOfYear     | week 15 of 2016                   | \<dateFormatItem id='yw' count='one'\>'week' w 'of' Y\<…       | The **week of** construction takes a count attribute, just in case the pattern changes depending on the numeric value of the **w** value. (In the future, we're likely to add an ordinal value, for constructions like “3rd week of March”.) In languages where the month name needs grammatical changes (aside from just the simple addition of a prefix or suffix), localizers will typically use a work-around construction. |
1163*912701f9SAndroid Build Coastguard Worker| weekOfMonth    | week 2 of April 2nd week of April | \<dateFormatItem id='MMMMW'' count='one'\>'week' W 'of' MMM\<… |   (same comment as above) |
1164*912701f9SAndroid Build Coastguard Worker| weekOfDate     | the week of April 11, 2016        | \<field type="week"\>\<relativePeriod>the week of {0}\<…        | The date pattern that replaces {0} is determined separately and may use the first day or workday of the week, the range of the full week or work week, etc.   |
1165*912701f9SAndroid Build Coastguard Worker| weekOfInterval | the week of April 11–15           | \<field type="week"\>\<relativePeriod>the week of {0}\<…    |  (same comment as above) |
1166*912701f9SAndroid Build Coastguard Worker
1167*912701f9SAndroid Build Coastguard Worker#### First Day Overrides
1168*912701f9SAndroid Build Coastguard Worker
1169*912701f9SAndroid Build Coastguard WorkerThe calculation of the first day of the week depends on various fields in a locale_identifier, according to the following algorithm. The data in the `firstDay` elements is treated as a map from region to day, with any missing value using the value for 001.
1170*912701f9SAndroid Build Coastguard Worker
1171*912701f9SAndroid Build Coastguard Worker1. If there is a valid `-u-fw-` day value, return that day.
1172*912701f9SAndroid Build Coastguard Worker2. Else if there is a valid `-u-rg-` region value, return that region's firstDay map value.
1173*912701f9SAndroid Build Coastguard Worker3. Else if there is a valid `-u-ca-` calendar value, where that calendar specifies the first day, then return that first day. (Most calendars do not specify the first day.)
1174*912701f9SAndroid Build Coastguard Worker4. Else if there is an explicit region subtag, then return that region's firstDay map value.
1175*912701f9SAndroid Build Coastguard Worker5. Else if there is a valid `-u-sd-` subdivision value, return that region's firstDay map value.
1176*912701f9SAndroid Build Coastguard Worker6. Else if the [Add Likely Subtags](tr35.md#Likely_Subtags) algorithm produces a region, return that region's firstDay map value.
1177*912701f9SAndroid Build Coastguard Worker7. Else return the firstDay map value for 001.
1178*912701f9SAndroid Build Coastguard Worker
1179*912701f9SAndroid Build Coastguard Worker*Example:*
1180*912701f9SAndroid Build Coastguard Worker
1181*912701f9SAndroid Build Coastguard Worker| Locale Identifier | "Winning" subtags | Region |
1182*912701f9SAndroid Build Coastguard Worker|----|----|----|
1183*912701f9SAndroid Build Coastguard Worker|en-AU-u-ca-iso8601-fw-tue-rg-afzzzz-sd-cabc | -fw-tue | n/a, uses Tuesday |
1184*912701f9SAndroid Build Coastguard Worker|en-AU-u-ca-iso8601-rg-afzzzz-sd-cabc | -rg-afzzzz | AF |
1185*912701f9SAndroid Build Coastguard Worker|en-AU-u-ca-iso8601-sd-cabc | -ca-iso8601 | n/a, uses Monday |
1186*912701f9SAndroid Build Coastguard Worker|en-AU-u-sd-cabc | -AU | AU |
1187*912701f9SAndroid Build Coastguard Worker|en-u-sd-cabc | -sd-cabc | CA |
1188*912701f9SAndroid Build Coastguard Worker|en | | US (from likely subtags) |
1189*912701f9SAndroid Build Coastguard Worker|zxx | 001 | (fallback) |
1190*912701f9SAndroid Build Coastguard Worker
1191*912701f9SAndroid Build Coastguard Worker### <a name="Time_Data" href="#Time_Data">Time Data</a>
1192*912701f9SAndroid Build Coastguard Worker
1193*912701f9SAndroid Build Coastguard Worker```xml
1194*912701f9SAndroid Build Coastguard Worker<!ELEMENT timeData ( hours* ) >
1195*912701f9SAndroid Build Coastguard Worker<!ELEMENT hours EMPTY >
1196*912701f9SAndroid Build Coastguard Worker<!ATTLIST hours preferred NMTOKEN #REQUIRED >
1197*912701f9SAndroid Build Coastguard Worker<!ATTLIST hours allowed NMTOKENS #REQUIRED >
1198*912701f9SAndroid Build Coastguard Worker<!ATTLIST hours regions NMTOKENS #REQUIRED >
1199*912701f9SAndroid Build Coastguard Worker```
1200*912701f9SAndroid Build Coastguard Worker
1201*912701f9SAndroid Build Coastguard WorkerThis element is for data that indicates, for various regions, the preferred time cycle in the region, as well as all time cycles that are considered acceptable in the region. The defaults are those specified for region 001.
1202*912701f9SAndroid Build Coastguard Worker
1203*912701f9SAndroid Build Coastguard WorkerThere is a single `preferred` value, and multiple `allowed` values. The meanings of the values H, h, K, k, b and B are defined in [Date Field Symbol Table](#Date_Field_Symbol_Table). The `allowed` values are in preference order, and are used with the 'C' hour skeleton pattern symbol.
1204*912701f9SAndroid Build Coastguard Worker
1205*912701f9SAndroid Build Coastguard WorkerFor example, in the following, RU (Russia) is marked as using only 24 hour time, and in particular the 24 hour time that goes from 0..23 (H), rather than from 1..24 (k).
1206*912701f9SAndroid Build Coastguard Worker
1207*912701f9SAndroid Build Coastguard WorkerAlso note that the `regions` allows either region codes (`001`, `JP`) or
1208*912701f9SAndroid Build Coastguard Workerlocale IDs (`gu_IN`).
1209*912701f9SAndroid Build Coastguard Worker
1210*912701f9SAndroid Build Coastguard Worker```xml
1211*912701f9SAndroid Build Coastguard Worker<timeData>
1212*912701f9SAndroid Build Coastguard Worker    <hours preferred="H" allowed="H h" regions="001 …" />
1213*912701f9SAndroid Build Coastguard Worker    <hours preferred="H" allowed="H K h" regions="JP" />
1214*912701f9SAndroid Build Coastguard Worker    <hours preferred="H" allowed="H" regions="IL RU" />
1215*912701f9SAndroid Build Coastguard Worker    <hours preferred="h" allowed="H h" regions="AE AG AL … US … ZW" />
1216*912701f9SAndroid Build Coastguard Worker    <hours preferred="h" allowed="hB h hb H" regions="ta_IN"/>
1217*912701f9SAndroid Build Coastguard Worker    <hours preferred="h" allowed="hB hb h H" regions="TW ET gu_IN mr_IN pa_IN"/>
1218*912701f9SAndroid Build Coastguard Worker1219*912701f9SAndroid Build Coastguard Worker```
1220*912701f9SAndroid Build Coastguard Worker
1221*912701f9SAndroid Build Coastguard WorkerThe B and b date symbols provide for formats like “3:00 at night”. When the ‘C’ option is used, the values in `allowed` are traversed from first to last, picking the first available format. For example, in the following a system that supports hB should choose that as the most preferred format for the C (not the `preferred` value H).
1222*912701f9SAndroid Build Coastguard Worker
1223*912701f9SAndroid Build Coastguard Worker```xml
1224*912701f9SAndroid Build Coastguard Worker<hours preferred="H" allowed="hB H" regions="CD" />
1225*912701f9SAndroid Build Coastguard Worker<hours preferred="H" allowed="hB hb h H" regions="KE MM TZ UG" />
1226*912701f9SAndroid Build Coastguard Worker```
1227*912701f9SAndroid Build Coastguard Worker
1228*912701f9SAndroid Build Coastguard WorkerSome systems may not want to use B and b, even if preferred for the locale, so for compatibility the `preferred` value is limited to {H, h, K, k}, and is the option selected by the ‘j’ date symbol. Thus the `preferred` value may not be the same as the first `allowed` value.
1229*912701f9SAndroid Build Coastguard Worker
1230*912701f9SAndroid Build Coastguard WorkerThe preferred value for the locale can be overridden by the locale keyword "hc", see [Unicode Hour Cycle Identifier ](tr35.md#UnicodeHourCycleIdentifier).
1231*912701f9SAndroid Build Coastguard Worker
1232*912701f9SAndroid Build Coastguard Worker### <a name="Day_Period_Rule_Sets" href="#Day_Period_Rule_Sets">Day Period Rule Sets</a>
1233*912701f9SAndroid Build Coastguard Worker
1234*912701f9SAndroid Build Coastguard Worker```xml
1235*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayPeriodRuleSet ( dayPeriodRules* ) >
1236*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriodRuleSet type NMTOKEN #IMPLIED >
1237*912701f9SAndroid Build Coastguard Worker
1238*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayPeriodRules (dayPeriodRule*) >
1239*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriodRules locales NMTOKENS #REQUIRED >
1240*912701f9SAndroid Build Coastguard Worker
1241*912701f9SAndroid Build Coastguard Worker<!ELEMENT dayPeriodRule EMPTY >
1242*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriodRule type NMTOKEN #REQUIRED >
1243*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriodRule at NMTOKEN #IMPLIED >
1244*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriodRule from NMTOKEN #IMPLIED >
1245*912701f9SAndroid Build Coastguard Worker<!ATTLIST dayPeriodRule before NMTOKEN #IMPLIED >
1246*912701f9SAndroid Build Coastguard Worker```
1247*912701f9SAndroid Build Coastguard Worker
1248*912701f9SAndroid Build Coastguard WorkerEach locale can have a set of day period rules, which determine the periods during a day for use in time formats like "10:00 at night", or to select statements like "Your email arrived last night." If locales do not have dayPeriodRules, the computation of dayPeriods falls back to AM/PM.
1249*912701f9SAndroid Build Coastguard Worker
1250*912701f9SAndroid Build Coastguard WorkerThere are two kinds of dayPeriodRuleSets, based on the type:
1251*912701f9SAndroid Build Coastguard Worker
1252*912701f9SAndroid Build Coastguard WorkerThe **_format_** type is used in conjunction with times, such as to express "3:00 in the afternoon", or "12:00 noon". Many languages do not normally use terms that match AM/PM for such times, instead breaking up the day into more periods.
1253*912701f9SAndroid Build Coastguard Worker
1254*912701f9SAndroid Build Coastguard WorkerThe **stand-alone** type is used for selecting a period of the day for a general time associated with an event. For example, it can be used to select a message like:
1255*912701f9SAndroid Build Coastguard Worker
1256*912701f9SAndroid Build Coastguard Worker```
1257*912701f9SAndroid Build Coastguard Worker<msg ... >
1258*912701f9SAndroid Build Coastguard Worker{day_period, select,
1259*912701f9SAndroid Build Coastguard WorkerMORNING1 {Your email arrived yesterday morning.}
1260*912701f9SAndroid Build Coastguard WorkerAFTERNOON1 {Your email arrived yesterday afternoon.}
1261*912701f9SAndroid Build Coastguard WorkerEVENING1 {Your email arrived yesterday evening.}
1262*912701f9SAndroid Build Coastguard WorkerNIGHT1 {Your email arrived last night.}
1263*912701f9SAndroid Build Coastguard Workerother {Your email arrived yesterday.}
1264*912701f9SAndroid Build Coastguard Worker...
1265*912701f9SAndroid Build Coastguard Worker}
1266*912701f9SAndroid Build Coastguard Worker</msg>
1267*912701f9SAndroid Build Coastguard Worker```
1268*912701f9SAndroid Build Coastguard Worker
1269*912701f9SAndroid Build Coastguard WorkerThe translated values for the selection (**stand-alone**) day periods are intended for use in designating a time of day, without an hour value.
1270*912701f9SAndroid Build Coastguard Worker
1271*912701f9SAndroid Build Coastguard WorkerThese are relative times within a single day. If the event can occur on multiple days, then that needs to be handled at a higher level.
1272*912701f9SAndroid Build Coastguard Worker
1273*912701f9SAndroid Build Coastguard WorkerAs with plurals, the exact set of periods used for any language may be different. It is the responsibility of any translation software to pick the relevant day periods for the locale for display to the translator (and end user).
1274*912701f9SAndroid Build Coastguard Worker
1275*912701f9SAndroid Build Coastguard Worker#### <a name="Day_Period_Rules" href="#Day_Period_Rules">Day Period Rules</a>
1276*912701f9SAndroid Build Coastguard Worker
1277*912701f9SAndroid Build Coastguard WorkerHere are the requirements for a rule set.
1278*912701f9SAndroid Build Coastguard Worker
1279*912701f9SAndroid Build Coastguard Worker##### <a name="Fixed_periods" href="#Fixed_periods">Fixed periods</a>
1280*912701f9SAndroid Build Coastguard Worker
1281*912701f9SAndroid Build Coastguard WorkerThere are 4 dayPeriods that are fixed; am/pm are always defined, and always have the same meaning and definition for every locale. Midnight and noon are optional, however if they are defined, they have the same meaning and definition as in all other locales where they are defined.
1282*912701f9SAndroid Build Coastguard Worker
1283*912701f9SAndroid Build Coastguard Worker```xml
1284*912701f9SAndroid Build Coastguard Worker<dayPeriodRule type="midnight" at="00:00" />
1285*912701f9SAndroid Build Coastguard Worker<dayPeriodRule type="am" from="00:00" before="12:00" />
1286*912701f9SAndroid Build Coastguard Worker<dayPeriodRule type="noon" at="12:00" />
1287*912701f9SAndroid Build Coastguard Worker<dayPeriodRule type="pm" from="12:00" before="24:00" />
1288*912701f9SAndroid Build Coastguard Worker```
1289*912701f9SAndroid Build Coastguard Worker
1290*912701f9SAndroid Build Coastguard WorkerNote that midnight and am can overlap, as can noon and pm.
1291*912701f9SAndroid Build Coastguard Worker
1292*912701f9SAndroid Build Coastguard WorkerAll locales must support am/pm, but not all support **noon** or **midnight**; they are only supported if they meet the above definitions. For example, German has no unique term that means exactly 12:00 noon; the closest is Mittag, but that can extend before or after 12 noon.
1293*912701f9SAndroid Build Coastguard Worker
1294*912701f9SAndroid Build Coastguard Worker**Midnight** is also special, since it can refer to either 00:00 or 24:00 — either at the start or end of the day. That means that Tuesday 24:00 = Wednesday 00:00. “Midnight Tuesday" is thus ambiguous: it means 24:00 in “the party is Tuesday from 10pm to 12 midnight”, while it means 00:00 in “I was awake from 12 midnight to 3 in the morning”.
1295*912701f9SAndroid Build Coastguard Worker
1296*912701f9SAndroid Build Coastguard WorkerIt is strongly recommended that implementations provide for the ability to specify whether **midnight** is supported or not (and for either 00:00 or 24:00 or both), since only the caller knows enough of the context to determine what to use. In the absence of such information, 24:00 may be the best choice.
1297*912701f9SAndroid Build Coastguard Worker
1298*912701f9SAndroid Build Coastguard Worker##### <a name="Variable_periods" href="#Variable_periods">Variable periods</a>
1299*912701f9SAndroid Build Coastguard Worker
1300*912701f9SAndroid Build Coastguard Worker1. If a locale has a set of dayPeriodRules for variable periods, it needs to completely cover the 24 hours in a day (from 0:00 before 24:00), with **no** overlaps between any dayPeriodRules. They may overlap with the **Fixed Periods**.
1301*912701f9SAndroid Build Coastguard Worker   If it does not have a rule set for variable periods, behavior should fall back to using the fixed periods (am, pm).
1302*912701f9SAndroid Build Coastguard Worker2. "from" is a closed interval (inclusive). _(as is the deprecated "to")_
1303*912701f9SAndroid Build Coastguard Worker3. "before" is an open interval (exclusive). _(as is the deprecated "after")_
1304*912701f9SAndroid Build Coastguard Worker4. "at" means starting time and end time are the same. _("at" is deprecated except when used for the fixed periods)_
1305*912701f9SAndroid Build Coastguard Worker5. There must be exactly one of {at, from, after} and exactly one of {at, to, before} for each dayPeriodRule.
1306*912701f9SAndroid Build Coastguard Worker6. Use of non-zero minutes or seconds is deprecated.
1307*912701f9SAndroid Build Coastguard Worker7. The dayPeriodRules for format must allow that hh:mm [period name] and hh [period name] can be parsed uniquely to HH:mm [period name].
1308*912701f9SAndroid Build Coastguard Worker   * For example, you can't have `<dayPeriod type = "morning1" from="00:00" to="13:00"/>` because "12:30 {morning}" would be ambiguous.
1309*912701f9SAndroid Build Coastguard Worker8. There must not be two rules with the same type. A day period rule may, however, span 24:00 / 00:00. Example:
1310*912701f9SAndroid Build Coastguard Worker   * _Valid:_
1311*912701f9SAndroid Build Coastguard Worker     * `<dayPeriod type = "night1" from="21:00" to="05:00"/>`
1312*912701f9SAndroid Build Coastguard Worker   * _Invalid:_
1313*912701f9SAndroid Build Coastguard Worker     * `<dayPeriod type = "night1" from="00:00" to="05:00"/>`
1314*912701f9SAndroid Build Coastguard Worker     * `<dayPeriod type = "night1" from="21:00" to="24:00"/>`
1315*912701f9SAndroid Build Coastguard Worker9. 24:00 is _only_ allowed in _before_="24:00".
1316*912701f9SAndroid Build Coastguard Worker
1317*912701f9SAndroid Build Coastguard Worker##### <a name="Parsing_Day_Periods" href="#Parsing_Day_Periods">Parsing Day Periods</a>
1318*912701f9SAndroid Build Coastguard Worker
1319*912701f9SAndroid Build Coastguard WorkerWhen parsing, if the hour is present with a strict parse the dayperiod is checked for consistency with the hour. If there is no hour, the center of the first matching dayPeriodRule can be chosen (starting from 0:00). However, if there is other information available when parsing, a different point within the interval may be chosen.
1320*912701f9SAndroid Build Coastguard Worker
1321*912701f9SAndroid Build Coastguard WorkerThe dayPeriodRule may span two days, such as where **night1** is [21:00, 06:00). In that case, the midpoint is 01:30, so when parsing “Nov 12, at night”, the midpoint result would be Nov 12, 01:30. “Nov 12, am”, “Nov 12, pm”, “Nov 12, noon” can be parsed similarly, resulting in Nov 12, 06:00; Nov 12, 18:00; and Nov 12, 12:00; respectively.
1322*912701f9SAndroid Build Coastguard Worker
1323*912701f9SAndroid Build Coastguard Worker“Nov 12, midnight” is special, because midnight may mean either 00:00 or 24:00. Extra information may be needed to disambiguate which is meant, such as whether the time is at the start or end of an interval. In the absence of such information, 24:00 may be the best choice. See the discussion of **midnight** above.
1324*912701f9SAndroid Build Coastguard Worker
1325*912701f9SAndroid Build Coastguard WorkerIf rounding is done—including the rounding done by the time format—then it needs to be done before the dayperiod is computed, so that the correct format is shown.
1326*912701f9SAndroid Build Coastguard Worker
1327*912701f9SAndroid Build Coastguard WorkerFor examples, see [Day Periods Chart](https://unicode-org.github.io/cldr-staging/charts/38/supplemental/day_periods.html).
1328*912701f9SAndroid Build Coastguard Worker
1329*912701f9SAndroid Build Coastguard Worker## <a name="Time_Zone_Names" href="#Time_Zone_Names">Time Zone Names</a>
1330*912701f9SAndroid Build Coastguard Worker
1331*912701f9SAndroid Build Coastguard Worker```xml
1332*912701f9SAndroid Build Coastguard Worker<!ELEMENT timeZoneNames (alias | (hourFormat*, gmtFormat*, gmtZeroFormat*, regionFormat*, fallbackFormat*, zone*, metazone*, special*)) >
1333*912701f9SAndroid Build Coastguard Worker
1334*912701f9SAndroid Build Coastguard Worker<!ELEMENT hourFormat ( #PCDATA ) >
1335*912701f9SAndroid Build Coastguard Worker<!ELEMENT gmtFormat ( #PCDATA ) >
1336*912701f9SAndroid Build Coastguard Worker<!ELEMENT gmtZeroFormat ( #PCDATA ) >
1337*912701f9SAndroid Build Coastguard Worker
1338*912701f9SAndroid Build Coastguard Worker<!ELEMENT regionFormat ( #PCDATA ) >
1339*912701f9SAndroid Build Coastguard Worker<!ATTLIST regionFormat type ( standard | daylight ) #IMPLIED >
1340*912701f9SAndroid Build Coastguard Worker
1341*912701f9SAndroid Build Coastguard Worker<!ELEMENT fallbackFormat ( #PCDATA ) >
1342*912701f9SAndroid Build Coastguard Worker
1343*912701f9SAndroid Build Coastguard Worker<!ELEMENT zone (alias | ( long*, short*, exemplarCity*, special*)) >
1344*912701f9SAndroid Build Coastguard Worker<!ATTLIST zone type CDATA #REQUIRED >
1345*912701f9SAndroid Build Coastguard Worker
1346*912701f9SAndroid Build Coastguard Worker<!ELEMENT metazone (alias | ( long*, short*, special*)) >
1347*912701f9SAndroid Build Coastguard Worker<!ATTLIST metazone type CDATA #REQUIRED >
1348*912701f9SAndroid Build Coastguard Worker
1349*912701f9SAndroid Build Coastguard Worker<!ELEMENT long (alias | (generic*, standard*, daylight*, special*)) >
1350*912701f9SAndroid Build Coastguard Worker<!ELEMENT short (alias | (generic*, standard*, daylight*, special*)) >
1351*912701f9SAndroid Build Coastguard Worker
1352*912701f9SAndroid Build Coastguard Worker<!ELEMENT generic ( #PCDATA ) >
1353*912701f9SAndroid Build Coastguard Worker<!ELEMENT standard ( #PCDATA ) >
1354*912701f9SAndroid Build Coastguard Worker<!ELEMENT daylight ( #PCDATA ) >
1355*912701f9SAndroid Build Coastguard Worker
1356*912701f9SAndroid Build Coastguard Worker<!ELEMENT exemplarCity ( #PCDATA ) >
1357*912701f9SAndroid Build Coastguard Worker```
1358*912701f9SAndroid Build Coastguard Worker
1359*912701f9SAndroid Build Coastguard WorkerThe time zone IDs (TZID) are language-independent, and follow the _TZ time zone database_ [[Olson](tr35.md#Olson)] and naming conventions. However, the display names for those IDs can vary by locale. The generic time is so-called _wall-time_; what clocks use when they are correctly switched from standard to daylight time at the mandated time of the year.
1360*912701f9SAndroid Build Coastguard Worker
1361*912701f9SAndroid Build Coastguard WorkerUnfortunately, the canonical TZIDs (those in zone.tab) are not stable: they may change in each release of the _TZ_ Time Zone database. In CLDR, however, stability of identifiers is very important. So the canonical IDs in CLDR are kept stable as described in [Canonical Form](tr35.md#Canonical_Form).
1362*912701f9SAndroid Build Coastguard Worker
1363*912701f9SAndroid Build Coastguard WorkerThe _TZ time zone database_ can have multiple IDs that refer to the same entity. It does contain information on equivalence relationships between these IDs, such as "Asia/Calcutta" and "Asia/Kolkata". It does not remove IDs (with a few known exceptions), but it may change the "canonical" ID which is in the file zone.tab.
1364*912701f9SAndroid Build Coastguard Worker
1365*912701f9SAndroid Build Coastguard WorkerFor lookup purposes specifications such as CLDR need a stable canonical ID, one that does not change from release to release. The stable ID is maintained as the first alias item _type_ element in the file bcp47/timezone.xml, such as:
1366*912701f9SAndroid Build Coastguard Worker
1367*912701f9SAndroid Build Coastguard Worker    <type name="inccu" alias="Asia/Calcutta Asia/Kolkata"/>
1368*912701f9SAndroid Build Coastguard Worker
1369*912701f9SAndroid Build Coastguard WorkerThat file also contains the short ID used in keywords. In versions of CLDR previous to 1.8, the alias information (but not the short ID) was in Supplemental Data under the zoneItem, such as:
1370*912701f9SAndroid Build Coastguard Worker
1371*912701f9SAndroid Build Coastguard Worker    <zoneItem type="Asia/Calcutta" territory="IN" aliases="Asia/Kolkata"/>
1372*912701f9SAndroid Build Coastguard Worker
1373*912701f9SAndroid Build Coastguard WorkerThis element was deprecated after the introduction of bcp47/timezone.xml, because the information became redundant (or was contained in the _TZ time zone database_).
1374*912701f9SAndroid Build Coastguard Worker
1375*912701f9SAndroid Build Coastguard WorkerThe following is an example of time zone data. Although this is an example of possible data, in most cases only the exemplarCity needs translation. And that does not even need to be present, if a country only has a single time one. As always, the _type_ field for each zone is the identification of that zone. It is not to be translated.
1376*912701f9SAndroid Build Coastguard Worker
1377*912701f9SAndroid Build Coastguard Worker```xml
1378*912701f9SAndroid Build Coastguard Worker<zone type="America/Los_Angeles">
1379*912701f9SAndroid Build Coastguard Worker    <long>
1380*912701f9SAndroid Build Coastguard Worker        <generic>Pacific Time</generic>
1381*912701f9SAndroid Build Coastguard Worker        <standard>Pacific Standard Time</standard>
1382*912701f9SAndroid Build Coastguard Worker        <daylight>Pacific Daylight Time</daylight>
1383*912701f9SAndroid Build Coastguard Worker    </long>
1384*912701f9SAndroid Build Coastguard Worker    <short>
1385*912701f9SAndroid Build Coastguard Worker        <generic>PT</generic>
1386*912701f9SAndroid Build Coastguard Worker        <standard>PST</standard>
1387*912701f9SAndroid Build Coastguard Worker        <daylight>PDT</daylight>
1388*912701f9SAndroid Build Coastguard Worker    </short>
1389*912701f9SAndroid Build Coastguard Worker    <exemplarCity>San Francisco</exemplarCity>
1390*912701f9SAndroid Build Coastguard Worker</zone>
1391*912701f9SAndroid Build Coastguard Worker
1392*912701f9SAndroid Build Coastguard Worker<zone type="Europe/London">
1393*912701f9SAndroid Build Coastguard Worker     <long>
1394*912701f9SAndroid Build Coastguard Worker        <generic>British Time</generic>
1395*912701f9SAndroid Build Coastguard Worker        <standard>British Standard Time</standard>
1396*912701f9SAndroid Build Coastguard Worker        <daylight>British Daylight Time</daylight>
1397*912701f9SAndroid Build Coastguard Worker    </long>
1398*912701f9SAndroid Build Coastguard Worker    <exemplarCity>York</exemplarCity>
1399*912701f9SAndroid Build Coastguard Worker</zone>
1400*912701f9SAndroid Build Coastguard Worker```
1401*912701f9SAndroid Build Coastguard Worker
1402*912701f9SAndroid Build Coastguard WorkerIn a few cases, some time zone IDs do not designate a city, as in:
1403*912701f9SAndroid Build Coastguard Worker
1404*912701f9SAndroid Build Coastguard Worker```xml
1405*912701f9SAndroid Build Coastguard Worker<zone type="America/Puerto_Rico">
1406*912701f9SAndroid Build Coastguard Worker    ...
1407*912701f9SAndroid Build Coastguard Worker</zone>
1408*912701f9SAndroid Build Coastguard Worker
1409*912701f9SAndroid Build Coastguard Worker<zone type="America/Guyana">
1410*912701f9SAndroid Build Coastguard Worker    ...
1411*912701f9SAndroid Build Coastguard Worker</zone>
1412*912701f9SAndroid Build Coastguard Worker
1413*912701f9SAndroid Build Coastguard Worker<zone type="America/Cayman">
1414*912701f9SAndroid Build Coastguard Worker    ...
1415*912701f9SAndroid Build Coastguard Worker</zone>
1416*912701f9SAndroid Build Coastguard Worker
1417*912701f9SAndroid Build Coastguard Worker<zone type="America/St_Vincent">
1418*912701f9SAndroid Build Coastguard Worker    ...
1419*912701f9SAndroid Build Coastguard Worker</zone>
1420*912701f9SAndroid Build Coastguard Worker```
1421*912701f9SAndroid Build Coastguard Worker
1422*912701f9SAndroid Build Coastguard WorkerThey may designate countries or territories; their actual capital city may be a name that is too common, or too uncommon. CLDR time zone IDs follow the [Olson](tr35.md#Olson) naming conventions.
1423*912701f9SAndroid Build Coastguard Worker
1424*912701f9SAndroid Build Coastguard Worker> **Note:** CLDR does not allow "GMT", "UT", or "UTC" as translations (short or long) of time zones other than GMT itself.
1425*912701f9SAndroid Build Coastguard Worker
1426*912701f9SAndroid Build Coastguard Worker> **Note:** Transmitting "14:30" with no other context is incomplete unless it contains information about the time zone. Ideally one would transmit neutral-format date/time information, commonly in UTC (GMT), and localize as close to the user as possible. (For more about UTC, see [[UTCInfo](tr35.md#UTCInfo)].)
1427*912701f9SAndroid Build Coastguard Worker
1428*912701f9SAndroid Build Coastguard WorkerThe conversion from local time into UTC depends on the particular time zone rules, which will vary by location. The standard data used for converting local time (sometimes called _wall time_) to UTC and back is the _TZ Data_ [[Olson](tr35.md#Olson)], used by Linux, UNIX, Java, ICU, and others. The data includes rules for matching the laws for time changes in different countries. For example, for the US it is:
1429*912701f9SAndroid Build Coastguard Worker
1430*912701f9SAndroid Build Coastguard Worker> "During the period commencing at 2 o'clock antemeridian on the second Sunday of March of each year and ending at 2 o'clock antemeridian on the first Sunday of November of each year, the standard time of each zone established by sections 261 to 264 of this title, as modified by of this title, shall be advanced one hour..." (United States Law - 15 U.S.C. §6(IX)(260-7), as amended by Energy Policy Act of 2005).
1431*912701f9SAndroid Build Coastguard Worker
1432*912701f9SAndroid Build Coastguard WorkerEach region that has a different time zone or daylight savings time rules, either now or at any time back to 1970, is given a unique internal ID, such as `Europe/Paris` . (Some IDs are also distinguished on the basis of differences before 1970.) As with currency codes, these are internal codes. A localized string associated with these is provided for users (such as in the Windows _Control Panels>Date/Time>Time Zone_).
1433*912701f9SAndroid Build Coastguard Worker
1434*912701f9SAndroid Build Coastguard WorkerUnfortunately, laws change over time, and will continue to change in the future, both for the boundaries of time zone regions and the rules for daylight savings. Thus the _TZ_ data is continually being augmented. Any two implementations using the same version of the _TZ_ data will get the same results for the same IDs (assuming a correct implementation). However, if implementations use different versions of the data they may get different results. So if precise results are required then both the _TZ_ ID and the _TZ_ data version must be transmitted between the different implementations.
1435*912701f9SAndroid Build Coastguard Worker
1436*912701f9SAndroid Build Coastguard WorkerFor more information, see [[Data Formats](tr35.md#DataFormats)].
1437*912701f9SAndroid Build Coastguard Worker
1438*912701f9SAndroid Build Coastguard WorkerThe following subelements of `<timeZoneNames>` are used to control the fallback process described in [Using Time Zone Names](#Using_Time_Zone_Names).
1439*912701f9SAndroid Build Coastguard Worker
1440*912701f9SAndroid Build Coastguard Worker###### Table: <a name="timeZoneNames_Elements_Used_for_Fallback" href="#timeZoneNames_Elements_Used_for_Fallback">timeZoneNames Elements Used for Fallback</a>
1441*912701f9SAndroid Build Coastguard Worker
1442*912701f9SAndroid Build Coastguard Worker<table><tbody>
1443*912701f9SAndroid Build Coastguard Worker<tr><th>Element Name</th><th>Data Examples</th><th>Results/Comment</th></tr>
1444*912701f9SAndroid Build Coastguard Worker<tr><td rowspan="2">hourFormat</td><td rowspan="2">"+HHmm;-HHmm"</td><td>"+1200"</td></tr>
1445*912701f9SAndroid Build Coastguard Worker    <tr><td>"-1200"</td></tr>
1446*912701f9SAndroid Build Coastguard Worker<tr><td rowspan="2">gmtFormat</td><td>"GMT{0}"</td><td>"GMT-0800"</td></tr>
1447*912701f9SAndroid Build Coastguard Worker    <tr><td>"{0}ВпГ"</td><td>"-0800ВпГ"</td></tr>
1448*912701f9SAndroid Build Coastguard Worker<tr><td>gmtZeroFormat</td><td>"GMT"</td><td>Specifies how GMT/UTC with no explicit offset (implied 0 offset) should be represented.</td></tr>
1449*912701f9SAndroid Build Coastguard Worker<tr><td rowspan="2">regionFormat</td><td>"{0} Time"</td><td>"Japan Time"</td></tr>
1450*912701f9SAndroid Build Coastguard Worker    <tr><td>"Hora de {0}"</td><td>"Hora de Japón"</td></tr>
1451*912701f9SAndroid Build Coastguard Worker<tr><td rowspan="2">regionFormat type="daylight"<br>(or "standard")</td><td>"{0} Daylight Time"</td><td>"France Daylight Time"</td></tr><tr><td>"horario de verano de {0}"</td><td>"horario de verano de Francia"</td></tr>
1452*912701f9SAndroid Build Coastguard Worker    <tr><td>fallbackFormat</td><td>"{1} ({0})"</td><td>"Pacific Time (Canada)"</td></tr>
1453*912701f9SAndroid Build Coastguard Worker</tbody></table>
1454*912701f9SAndroid Build Coastguard Worker
1455*912701f9SAndroid Build Coastguard WorkerWhen referring to the abbreviated (short) form of the time zone name, there are often situations where the location-based (city or country) time zone designation for a particular language may not be in common usage in a particular territory.
1456*912701f9SAndroid Build Coastguard Worker
1457*912701f9SAndroid Build Coastguard Worker> **Note:** User interfaces for time zone selection can use the "generic location format" for time zone names to obtain the most useful ordering of names in a menu or list; see _[Using Time Zone Names](#Using_Time_Zone_Names)_ and the zone section of the _[Date Field Symbol Table](#Date_Field_Symbol_Table)._
1458*912701f9SAndroid Build Coastguard Worker
1459*912701f9SAndroid Build Coastguard Worker### <a name="Metazone_Names" href="#Metazone_Names">Metazone Names</a>
1460*912701f9SAndroid Build Coastguard Worker
1461*912701f9SAndroid Build Coastguard WorkerA metazone is a grouping of one or more internal TZIDs that share a common display name in current customary usage, or that have shared a common display name during some particular time period. For example, the zones _Europe/Paris, Europe/Andorra, Europe/Tirane, Europe/Vienna, Europe/Sarajevo, Europe/Brussels, Europe/Zurich, Europe/Prague, Europe/Berlin_, and so on are often simply designated _Central European Time_ (or translated equivalent).
1462*912701f9SAndroid Build Coastguard Worker
1463*912701f9SAndroid Build Coastguard WorkerA metazone's display fields become a secondary fallback if an appropriate data field cannot be found in the explicit time zone data. The _usesMetazone_ field indicates that the target metazone is active for a particular time. This also provides a mechanism to effectively deal with situations where the time zone in use has changed for some reason. For example, consider the TZID "America/Indiana/Knox", which observed Central time (GMT-6:00) prior to October 27, 1991, and has currently observed Central time since April 2, 2006, but has observed Eastern time (GMT-5:00) between these two dates. This is denoted as follows
1464*912701f9SAndroid Build Coastguard Worker
1465*912701f9SAndroid Build Coastguard Worker```xml
1466*912701f9SAndroid Build Coastguard Worker<timezone type="America/Indiana/Knox">
1467*912701f9SAndroid Build Coastguard Worker  <usesMetazone to="1991-10-27 07:00" mzone="America_Central" />
1468*912701f9SAndroid Build Coastguard Worker  <usesMetazone to="2006-04-02 07:00" from="1991-10-27 07:00" mzone="America_Eastern" />
1469*912701f9SAndroid Build Coastguard Worker  <usesMetazone from="2006-04-02 07:00" mzone="America_Central" />
1470*912701f9SAndroid Build Coastguard Worker</timezone>
1471*912701f9SAndroid Build Coastguard Worker```
1472*912701f9SAndroid Build Coastguard Worker
1473*912701f9SAndroid Build Coastguard WorkerNote that the dates and times are specified in UTC, not local time.
1474*912701f9SAndroid Build Coastguard Worker
1475*912701f9SAndroid Build Coastguard WorkerThe metazones can then have translations in different locale files, such as the following.
1476*912701f9SAndroid Build Coastguard Worker
1477*912701f9SAndroid Build Coastguard Worker```xml
1478*912701f9SAndroid Build Coastguard Worker<metazone type="America_Central">
1479*912701f9SAndroid Build Coastguard Worker    <long>
1480*912701f9SAndroid Build Coastguard Worker        <generic>Central Time</generic>
1481*912701f9SAndroid Build Coastguard Worker        <standard>Central Standard Time</standard>
1482*912701f9SAndroid Build Coastguard Worker        <daylight>Central Daylight Time</daylight>
1483*912701f9SAndroid Build Coastguard Worker    </long>
1484*912701f9SAndroid Build Coastguard Worker    <short>
1485*912701f9SAndroid Build Coastguard Worker        <generic>CT</generic>
1486*912701f9SAndroid Build Coastguard Worker        <standard>CST</standard>
1487*912701f9SAndroid Build Coastguard Worker        <daylight>CDT</daylight>
1488*912701f9SAndroid Build Coastguard Worker    </short>
1489*912701f9SAndroid Build Coastguard Worker    </metazone>
1490*912701f9SAndroid Build Coastguard Worker    <metazone type="America_Eastern">
1491*912701f9SAndroid Build Coastguard Worker        <long>
1492*912701f9SAndroid Build Coastguard Worker        <generic>Eastern Time</generic>
1493*912701f9SAndroid Build Coastguard Worker        <standard>Eastern Standard Time</standard>
1494*912701f9SAndroid Build Coastguard Worker        <daylight>Eastern Daylight Time</daylight>
1495*912701f9SAndroid Build Coastguard Worker    </long>
1496*912701f9SAndroid Build Coastguard Worker    <short>
1497*912701f9SAndroid Build Coastguard Worker        <generic>ET</generic>
1498*912701f9SAndroid Build Coastguard Worker        <standard>EST</standard>
1499*912701f9SAndroid Build Coastguard Worker        <daylight>EDT</daylight>
1500*912701f9SAndroid Build Coastguard Worker    </short>
1501*912701f9SAndroid Build Coastguard Worker</metazone>
1502*912701f9SAndroid Build Coastguard Worker
1503*912701f9SAndroid Build Coastguard Worker<metazone type="America_Eastern">
1504*912701f9SAndroid Build Coastguard Worker    <long>
1505*912701f9SAndroid Build Coastguard Worker        <generic>Heure de l’Est</generic>
1506*912701f9SAndroid Build Coastguard Worker        <standard>Heure normale de l’Est</standard>
1507*912701f9SAndroid Build Coastguard Worker        <daylight>Heure avancée de l’Est</daylight>
1508*912701f9SAndroid Build Coastguard Worker    </long>
1509*912701f9SAndroid Build Coastguard Worker    <short>
1510*912701f9SAndroid Build Coastguard Worker        <generic>HE</generic>
1511*912701f9SAndroid Build Coastguard Worker        <standard>HNE</standard>
1512*912701f9SAndroid Build Coastguard Worker        <daylight>HAE</daylight>
1513*912701f9SAndroid Build Coastguard Worker    </short>
1514*912701f9SAndroid Build Coastguard Worker</metazone>
1515*912701f9SAndroid Build Coastguard Worker```
1516*912701f9SAndroid Build Coastguard Worker
1517*912701f9SAndroid Build Coastguard WorkerWhen formatting a date and time value using this data, an application can properly be able to display "Eastern Time" for dates between 1991-10-27 and 2006-04-02, but display "Central Time" for current dates. (See also _[Dates and Date Ranges](tr35.md#Date_Ranges)_.)
1518*912701f9SAndroid Build Coastguard Worker
1519*912701f9SAndroid Build Coastguard WorkerMetazones are used with the 'z', 'zzzz', 'v', and 'vvvv' date time pattern characters, and not with the 'Z', 'ZZZZ', 'VVVV' and other pattern characters for time zone formatting. For more information, see [Date Format Patterns](#Date_Format_Patterns).
1520*912701f9SAndroid Build Coastguard Worker
1521*912701f9SAndroid Build Coastguard WorkerNote that several of the CLDR metazone IDs are the same as TZID aliases provided by the _TZ time zone database_ and also included in ICU data. For example:
1522*912701f9SAndroid Build Coastguard Worker* “Japan” is a CLDR metazone ID (which has short ID “japa”), but also an alias to the TZID “Asia/Tokyo” (which has BCP 47 ID “jptyo”).
1523*912701f9SAndroid Build Coastguard Worker* “GMT” is a CLDR metazone ID (which has short ID “mgmt”), but also an alias to the TZID “Etc/GMT” (which has BCP 47 ID “gmt”).
1524*912701f9SAndroid Build Coastguard WorkerIn practice this is not an issue, since metazone IDs and TZIDs are never used in the same way in any data structure, or in the same APIs in a library such as ICU.
1525*912701f9SAndroid Build Coastguard Worker
1526*912701f9SAndroid Build Coastguard WorkerThe `commonlyUsed` element is now deprecated. The CLDR committee has found it nearly impossible to obtain accurate and reliable data regarding which time zone abbreviations may be understood in a given territory, and therefore has changed to a simpler approach. Thus, if the short metazone form is available in a given locale, it is to be used for formatting regardless of the value of commonlyUsed. If a given short metazone form is known NOT to be understood in a given locale and the parent locale has this value such that it would normally be inherited, the inheritance of this value can be explicitly disabled by use of the 'no inheritance marker' as the value, which is 3 simultaneous empty set characters (U+2205).
1527*912701f9SAndroid Build Coastguard Worker
1528*912701f9SAndroid Build Coastguard Worker## <a name="Supplemental_Time_Zone_Data" href="#Supplemental_Time_Zone_Data">Supplemental Time Zone Data</a>
1529*912701f9SAndroid Build Coastguard Worker
1530*912701f9SAndroid Build Coastguard Worker### <a name="Metazones" href="#Metazones">Metazones</a>
1531*912701f9SAndroid Build Coastguard Worker
1532*912701f9SAndroid Build Coastguard Worker```xml
1533*912701f9SAndroid Build Coastguard Worker<!ELEMENT metaZones (metazoneInfo?, mapTimezones?) >
1534*912701f9SAndroid Build Coastguard Worker
1535*912701f9SAndroid Build Coastguard Worker<!ELEMENT metazoneInfo (timezone*) >
1536*912701f9SAndroid Build Coastguard Worker
1537*912701f9SAndroid Build Coastguard Worker<!ELEMENT timezone (usesMetazone*) >
1538*912701f9SAndroid Build Coastguard Worker<!ATTLIST timezone type CDATA #REQUIRED >
1539*912701f9SAndroid Build Coastguard Worker
1540*912701f9SAndroid Build Coastguard Worker<!ELEMENT usesMetazone EMPTY >
1541*912701f9SAndroid Build Coastguard Worker<!ATTLIST usesMetazone mzone NMTOKEN #REQUIRED >
1542*912701f9SAndroid Build Coastguard Worker<!ATTLIST usesMetazone from CDATA #IMPLIED >
1543*912701f9SAndroid Build Coastguard Worker<!ATTLIST usesMetazone to CDATA #IMPLIED >
1544*912701f9SAndroid Build Coastguard Worker
1545*912701f9SAndroid Build Coastguard Worker<!ELEMENT mapTimezones ( mapZone* ) >
1546*912701f9SAndroid Build Coastguard Worker<!ATTLIST mapTimezones type NMTOKEN #IMPLIED >
1547*912701f9SAndroid Build Coastguard Worker<!ATTLIST mapTimezones typeVersion CDATA #IMPLIED >
1548*912701f9SAndroid Build Coastguard Worker<!ATTLIST mapTimezones otherVersion CDATA #IMPLIED >
1549*912701f9SAndroid Build Coastguard Worker<!ATTLIST mapTimezones references CDATA #IMPLIED >
1550*912701f9SAndroid Build Coastguard Worker
1551*912701f9SAndroid Build Coastguard Worker<!ELEMENT mapZone EMPTY >
1552*912701f9SAndroid Build Coastguard Worker<!ATTLIST mapZone type CDATA #REQUIRED >
1553*912701f9SAndroid Build Coastguard Worker<!ATTLIST mapZone other CDATA #REQUIRED >
1554*912701f9SAndroid Build Coastguard Worker<!ATTLIST mapZone territory CDATA #IMPLIED >
1555*912701f9SAndroid Build Coastguard Worker<!ATTLIST mapZone references CDATA #IMPLIED >
1556*912701f9SAndroid Build Coastguard Worker```
1557*912701f9SAndroid Build Coastguard Worker
1558*912701f9SAndroid Build Coastguard WorkerThe following subelement of `<metaZones>` provides a mapping from a single Unicode time zone id to metazones. For more information about metazones, see _[Time Zone Names](tr35-dates.md#Time_Zone_Names)_.
1559*912701f9SAndroid Build Coastguard Worker
1560*912701f9SAndroid Build Coastguard Worker```xml
1561*912701f9SAndroid Build Coastguard Worker<metazoneInfo>
1562*912701f9SAndroid Build Coastguard Worker    <timezone type="Europe/Andorra">
1563*912701f9SAndroid Build Coastguard Worker        <usesMetazone mzone="Europe_Central" />
1564*912701f9SAndroid Build Coastguard Worker    </timezone>
1565*912701f9SAndroid Build Coastguard Worker    ....
1566*912701f9SAndroid Build Coastguard Worker    <timezone type="Asia/Yerevan">
1567*912701f9SAndroid Build Coastguard Worker        <usesMetazone to="1991-09-22 20:00" mzone="Yerevan" />
1568*912701f9SAndroid Build Coastguard Worker        <usesMetazone from="1991-09-22 20:00" mzone="Armenia" />
1569*912701f9SAndroid Build Coastguard Worker    </timezone>
1570*912701f9SAndroid Build Coastguard Worker    ....
1571*912701f9SAndroid Build Coastguard Worker```
1572*912701f9SAndroid Build Coastguard Worker
1573*912701f9SAndroid Build Coastguard WorkerThe following subelement of `<metaZones>` specifies a mapping from a metazone to golden zones for each territory. For more information about golden zones, see _[Using Time Zone Names](tr35-dates.md#Using_Time_Zone_Names)_.
1574*912701f9SAndroid Build Coastguard Worker
1575*912701f9SAndroid Build Coastguard Worker```xml
1576*912701f9SAndroid Build Coastguard Worker<mapTimezones type="metazones">
1577*912701f9SAndroid Build Coastguard Worker    <mapZone other="Acre" territory="001" type="America/Rio_Branco" />
1578*912701f9SAndroid Build Coastguard Worker    <mapZone other="Afghanistan" territory="001" type="Asia/Kabul" />
1579*912701f9SAndroid Build Coastguard Worker    <mapZone other="Africa_Central" territory="001" type="Africa/Maputo" />
1580*912701f9SAndroid Build Coastguard Worker    <mapZone other="Africa_Central" territory="BI" type="Africa/Bujumbura" />
1581*912701f9SAndroid Build Coastguard Worker    <mapZone other="Africa_Central" territory="BW" type="Africa/Gaborone" />
1582*912701f9SAndroid Build Coastguard Worker    ....
1583*912701f9SAndroid Build Coastguard Worker```
1584*912701f9SAndroid Build Coastguard Worker
1585*912701f9SAndroid Build Coastguard Worker### <a name="Windows_Zones" href="#Windows_Zones">Windows Zones</a>
1586*912701f9SAndroid Build Coastguard Worker
1587*912701f9SAndroid Build Coastguard Worker```xml
1588*912701f9SAndroid Build Coastguard Worker<!ELEMENT windowsZones (mapTimezones?) >
1589*912701f9SAndroid Build Coastguard Worker```
1590*912701f9SAndroid Build Coastguard Worker
1591*912701f9SAndroid Build Coastguard WorkerThe `<mapTimezones>` element can be also used to provide mappings between Unicode time zone IDs and other time zone IDs. This example specifies a mapping from Windows TZIDs to Unicode time zone IDs.
1592*912701f9SAndroid Build Coastguard Worker
1593*912701f9SAndroid Build Coastguard Worker```xml
1594*912701f9SAndroid Build Coastguard Worker<mapTimezones otherVersion="07dc0000" typeVersion="2011n">
1595*912701f9SAndroid Build Coastguard Worker    ....
1596*912701f9SAndroid Build Coastguard Worker    <!-- (UTC-08:00) Baja California -->
1597*912701f9SAndroid Build Coastguard Worker    <mapZone other="Pacific Standard Time (Mexico)" territory="001" type="America/Santa_Isabel"/>
1598*912701f9SAndroid Build Coastguard Worker    <mapZone other="Pacific Standard Time (Mexico)" territory="MX" type="America/Santa_Isabel"/>
1599*912701f9SAndroid Build Coastguard Worker
1600*912701f9SAndroid Build Coastguard Worker    <!-- (UTC-08:00) Pacific Time (US & Canada) -->
1601*912701f9SAndroid Build Coastguard Worker    <mapZone other="Pacific Standard Time" territory="001" type="America/Los_Angeles"/>
1602*912701f9SAndroid Build Coastguard Worker    <mapZone other="Pacific Standard Time" territory="CA" type="America/Vancouver America/Dawson America/Whitehorse"/>
1603*912701f9SAndroid Build Coastguard Worker    <mapZone other="Pacific Standard Time" territory="MX" type="America/Tijuana"/>
1604*912701f9SAndroid Build Coastguard Worker    <mapZone other="Pacific Standard Time" territory="US" type="America/Los_Angeles"/>
1605*912701f9SAndroid Build Coastguard Worker    <mapZone other="Pacific Standard Time" territory="ZZ" type="PST8PDT"/>
1606*912701f9SAndroid Build Coastguard Worker    ....
1607*912701f9SAndroid Build Coastguard Worker```
1608*912701f9SAndroid Build Coastguard Worker
1609*912701f9SAndroid Build Coastguard WorkerThe attributes otherVersion and typeVersion in `<mapTimezones>` specify the versions of two systems. In the example above, otherVersion="07dc0000" specifies the version of Windows time zone and typeVersion="2011n" specifies the version of Unicode time zone IDs. The attribute `territory="001"` in `<mapZone>` element indicates the long canonical Unicode time zone ID specified by the `type` attribute is used as the default mapping for the Windows TZID. For each unique Windows TZID, there must be exactly one `<mapZone>` element with `territory="001"`. `<mapZone>` elements other than `territory="001"` specify territory specific mappings. When multiple Unicode time zone IDs are available for a single territory, the value of the `type` attribute will be a list of Unicode time zone IDs delimited by space. In this case, the first entry represents the default mapping for the territory. The territory "ZZ" is used when a Unicode time zone ID is not associated with a specific territory.
1610*912701f9SAndroid Build Coastguard Worker
1611*912701f9SAndroid Build Coastguard Worker**Note:** The long canonical Unicode time zone ID might be deprecated in the tz database [[Olson](tr35.md#Olson)]. For example, CLDR uses "Asia/Culcutta" as the long canonical time zone ID for Kolkata, India. The same ID was moved to 'backward' file and replaced with a new ID "Asia/Kolkata" in the tz database. Therefore, if you want to get an equivalent Windows TZID for a zone ID in the tz database, you have to resolve the long canonical Unicode time zone ID (e.g. "Asia/Culcutta") for the zone ID (e.g. "Asia/Kolkata"). For more details, see [Time Zone Identifiers](tr35.md#Time_Zone_Identifiers).
1612*912701f9SAndroid Build Coastguard Worker
1613*912701f9SAndroid Build Coastguard Worker**Note:** Not all Unicode time zones have equivalent Windows TZID mappings. Also, not all Windows TZIDs have equivalent Unicode time zones. For example, there is no equivalent Windows zone for Unicode time zone "Australia/Lord_Howe", and there is no equivalent Unicode time zone for Windows zone "E. Europe Standard Time" (as of CLDR 25 release).
1614*912701f9SAndroid Build Coastguard Worker
1615*912701f9SAndroid Build Coastguard Worker### <a name="Primary_Zones" href="#Primary_Zones">Primary Zones</a>
1616*912701f9SAndroid Build Coastguard Worker
1617*912701f9SAndroid Build Coastguard Worker```xml
1618*912701f9SAndroid Build Coastguard Worker<!ELEMENT primaryZones ( primaryZone* ) >
1619*912701f9SAndroid Build Coastguard Worker<!ELEMENT primaryZone ( #PCDATA ) >
1620*912701f9SAndroid Build Coastguard Worker<!ATTLIST primaryZone iso3166 NMTOKEN #REQUIRED >
1621*912701f9SAndroid Build Coastguard Worker```
1622*912701f9SAndroid Build Coastguard Worker
1623*912701f9SAndroid Build Coastguard WorkerThis element is for data that is used to format a time zone’s generic location name. Each `<primaryZone>` element specifies the dominant zone for a region; this zone should use the region name for its generic location name even though there are other canonical zones available in the same region. For example, Asia/Shanghai is displayed as "China Time", instead of "Shanghai Time". Sample data:
1624*912701f9SAndroid Build Coastguard Worker
1625*912701f9SAndroid Build Coastguard Worker```xml
1626*912701f9SAndroid Build Coastguard Worker<primaryZones>
1627*912701f9SAndroid Build Coastguard Worker    <primaryZone iso3166="CL">America/Santiago</primaryZone>
1628*912701f9SAndroid Build Coastguard Worker    <primaryZone iso3166="CN">Asia/Shanghai</primaryZone>
1629*912701f9SAndroid Build Coastguard Worker    <primaryZone iso3166="DE">Europe/Berlin</primaryZone>
1630*912701f9SAndroid Build Coastguard Worker1631*912701f9SAndroid Build Coastguard Worker```
1632*912701f9SAndroid Build Coastguard Worker
1633*912701f9SAndroid Build Coastguard WorkerThis information was previously specified by the LDML `<singleCountries>` element under each locale’s `<timeZoneNames>` element. However, that approach had inheritance issues, and the data is not really locale-specific anyway.
1634*912701f9SAndroid Build Coastguard Worker
1635*912701f9SAndroid Build Coastguard Worker## <a name="Using_Time_Zone_Names" href="#Using_Time_Zone_Names">Using Time Zone Names</a>
1636*912701f9SAndroid Build Coastguard Worker
1637*912701f9SAndroid Build Coastguard WorkerThere are three main types of formats for zone identifiers: GMT, generic (wall time), and standard/daylight. Standard and daylight are equivalent to a particular offset from GMT, and can be represented by a GMT offset as a fallback. In general, this is not true for the generic format, which is used for picking timezones or for conveying a timezone for specifying a recurring time (such as a meeting in a calendar). For either purpose, a GMT offset would lose information.
1638*912701f9SAndroid Build Coastguard Worker
1639*912701f9SAndroid Build Coastguard Worker### <a name="Time_Zone_Format_Terminology" href="#Time_Zone_Format_Terminology">Time Zone Format Terminology</a>
1640*912701f9SAndroid Build Coastguard Worker
1641*912701f9SAndroid Build Coastguard WorkerThe following terminology defines more precisely the formats that are used.
1642*912701f9SAndroid Build Coastguard Worker
1643*912701f9SAndroid Build Coastguard Worker**Generic non-location format:** Reflects "wall time" (what is on a clock on the wall): used for recurring events, meetings, or anywhere people do not want to be overly specific. For example, "10 am Pacific Time" will be GMT-8 in the winter, and GMT-7 in the summer.
1644*912701f9SAndroid Build Coastguard Worker
1645*912701f9SAndroid Build Coastguard Worker* "Pacific Time" (long)
1646*912701f9SAndroid Build Coastguard Worker* "PT" (short)
1647*912701f9SAndroid Build Coastguard Worker
1648*912701f9SAndroid Build Coastguard Worker**Generic partial location format:** Reflects "wall time": used as a fallback format when the generic non-location format is not specific enough.
1649*912701f9SAndroid Build Coastguard Worker
1650*912701f9SAndroid Build Coastguard Worker* "Pacific Time (Canada)" (long)
1651*912701f9SAndroid Build Coastguard Worker* "PT (Whitehorse)" (short)
1652*912701f9SAndroid Build Coastguard Worker
1653*912701f9SAndroid Build Coastguard Worker**Generic location format:** Reflects "wall time": a primary function of this format type is to represent a time zone in a list or menu for user selection of time zone. It is also a fallback format when there is no translation for the generic non-location format. Times can also be organized hierarchically by country for easier lookup.
1654*912701f9SAndroid Build Coastguard Worker
1655*912701f9SAndroid Build Coastguard Worker+ France Time
1656*912701f9SAndroid Build Coastguard Worker+ Italy Time
1657*912701f9SAndroid Build Coastguard Worker+ Japan Time
1658*912701f9SAndroid Build Coastguard Worker+ United States
1659*912701f9SAndroid Build Coastguard Worker  + Chicago Time
1660*912701f9SAndroid Build Coastguard Worker  + Denver Time
1661*912701f9SAndroid Build Coastguard Worker  + Los Angeles Time
1662*912701f9SAndroid Build Coastguard Worker  + New York Time
1663*912701f9SAndroid Build Coastguard Worker+ United Kingdom Time
1664*912701f9SAndroid Build Coastguard Worker
1665*912701f9SAndroid Build Coastguard WorkerNote: A generic location format is constructed by a part of time zone ID representing an exemplar city name or its country as the final fallback. However, there are Unicode time zones which are not associated with any locations, such as "Etc/GMT+5" and "PST8PDT". Although the date format pattern "VVVV" specifies the generic location format, but it displays localized GMT format for these. Some of these time zones observe daylight saving time, so the result (localized GMT format) may change depending on input date. For generating a list for user selection of time zone with format "VVVV", these non-location zones should be excluded.
1666*912701f9SAndroid Build Coastguard Worker
1667*912701f9SAndroid Build Coastguard Worker**Specific non-location format:** Reflects a specific standard or daylight time, which may or may not be the wall time. For example, "10 am Pacific Standard Time" will be GMT-8 in the winter and in the summer.
1668*912701f9SAndroid Build Coastguard Worker
1669*912701f9SAndroid Build Coastguard Worker* "Pacific Standard Time" (long)
1670*912701f9SAndroid Build Coastguard Worker* "PST" (short)
1671*912701f9SAndroid Build Coastguard Worker* "Pacific Daylight Time" (long)
1672*912701f9SAndroid Build Coastguard Worker* "PDT" (short)
1673*912701f9SAndroid Build Coastguard Worker
1674*912701f9SAndroid Build Coastguard Worker**Localized GMT format:** A constant, specific offset from GMT (or UTC), which may be in a translated form. There are two styles for this. The first is used when there is an explicit non-zero offset from GMT; this style is specified by the `<gmtFormat>` element and `<hourFormat>` element. The long format always uses 2-digit hours field and minutes field, with optional 2-digit seconds field. The short format is intended for the shortest representation and uses hour fields without leading zero, with optional 2-digit minutes and seconds fields. The digits used for hours, minutes and seconds fields in this format are the locale's default decimal digits:
1675*912701f9SAndroid Build Coastguard Worker
1676*912701f9SAndroid Build Coastguard Worker* "GMT+03:30" (long)
1677*912701f9SAndroid Build Coastguard Worker* "GMT+3:30" (short)
1678*912701f9SAndroid Build Coastguard Worker* "UTC-03.00" (long)
1679*912701f9SAndroid Build Coastguard Worker* "UTC-3" (short)
1680*912701f9SAndroid Build Coastguard Worker* "Гринуич+03:30" (long)
1681*912701f9SAndroid Build Coastguard Worker
1682*912701f9SAndroid Build Coastguard WorkerOtherwise (when the offset from GMT is zero, referring to GMT itself) the style specified by the `<gmtZeroFormat>` element is used:
1683*912701f9SAndroid Build Coastguard Worker
1684*912701f9SAndroid Build Coastguard Worker* "GMT"
1685*912701f9SAndroid Build Coastguard Worker* "UTC"
1686*912701f9SAndroid Build Coastguard Worker* "Гринуич"
1687*912701f9SAndroid Build Coastguard Worker
1688*912701f9SAndroid Build Coastguard Worker**ISO 8601 time zone formats:** The formats based on the [[ISO 8601](tr35.md#ISO8601)]  local time difference from UTC ("+" sign is used when local time offset is 0), or the UTC indicator ("Z" - only when the local time offset is 0 and the specifier X\* is used). The ISO 8601 basic format does not use a separator character between hours and minutes field, while the extended format uses colon (':') as the separator. The ISO 8601 basic format with hours and minutes fields is equivalent to RFC 822 zone format.
1689*912701f9SAndroid Build Coastguard Worker
1690*912701f9SAndroid Build Coastguard Worker* "-0800" (basic)
1691*912701f9SAndroid Build Coastguard Worker* "-08" (basic - short)
1692*912701f9SAndroid Build Coastguard Worker* "-08:00" (extended)
1693*912701f9SAndroid Build Coastguard Worker* "Z" (UTC)
1694*912701f9SAndroid Build Coastguard Worker
1695*912701f9SAndroid Build Coastguard Worker> Note: This specification extends the original ISO 8601 formats and some format specifiers append seconds field when necessary.
1696*912701f9SAndroid Build Coastguard Worker
1697*912701f9SAndroid Build Coastguard Worker**Raw Offset** - an offset from GMT that does not include any daylight savings behavior. For example, the raw offset for Pacific Time is -8, even though the _observed offset_ may be -8 or -7.
1698*912701f9SAndroid Build Coastguard Worker
1699*912701f9SAndroid Build Coastguard Worker**Metazone** - a collection of time zones that share the same behavior and same name during some period. They may differ in daylight behavior (whether they have it and when).
1700*912701f9SAndroid Build Coastguard Worker
1701*912701f9SAndroid Build Coastguard WorkerFor example, the TZID America/Cambridge_Bay is in the following metazones during various periods:
1702*912701f9SAndroid Build Coastguard Worker
1703*912701f9SAndroid Build Coastguard Worker```xml
1704*912701f9SAndroid Build Coastguard Worker<timezone type="America/Cambridge_Bay">
1705*912701f9SAndroid Build Coastguard Worker    <usesMetazone to="1999-10-31 08:00" mzone="America_Mountain" />
1706*912701f9SAndroid Build Coastguard Worker    <usesMetazone to="2000-10-29 07:00" from="1999-10-31 08:00" mzone="America_Central" />
1707*912701f9SAndroid Build Coastguard Worker    <usesMetazone to="2000-11-05 05:00" from="2000-10-29 07:00" mzone="America_Eastern" />
1708*912701f9SAndroid Build Coastguard Worker    <usesMetazone to="2001-04-01 09:00" from="2000-11-05 05:00" mzone="America_Central" />
1709*912701f9SAndroid Build Coastguard Worker    <usesMetazone from="2001-04-01 09:00" mzone="America_Mountain" />
1710*912701f9SAndroid Build Coastguard Worker</timezone>
1711*912701f9SAndroid Build Coastguard Worker```
1712*912701f9SAndroid Build Coastguard Worker
1713*912701f9SAndroid Build Coastguard WorkerZones may join or leave a metazone over time. The data relating between zones and metazones is in the supplemental information; the locale data is restricted to translations of metazones and zones.
1714*912701f9SAndroid Build Coastguard Worker
1715*912701f9SAndroid Build Coastguard Worker> **Invariants:**
1716*912701f9SAndroid Build Coastguard Worker>
1717*912701f9SAndroid Build Coastguard Worker> * At any given point in time, each zone belongs to no more than one metazone.
1718*912701f9SAndroid Build Coastguard Worker> * At a given point in time, a zone may not belong to any metazones.
1719*912701f9SAndroid Build Coastguard Worker> * _Except for daylight savings_, at any given time, all zones in a metazone have the same offset at that time.
1720*912701f9SAndroid Build Coastguard Worker
1721*912701f9SAndroid Build Coastguard Worker**Golden Zone** - the TZDB zone that exemplifies a metazone. For example, America/New_York is the golden zone for the metazone America_Eastern:
1722*912701f9SAndroid Build Coastguard Worker
1723*912701f9SAndroid Build Coastguard Worker```xml
1724*912701f9SAndroid Build Coastguard Worker<mapZone other="America_Eastern" territory="001" type="America/New_York"/>
1725*912701f9SAndroid Build Coastguard Worker```
1726*912701f9SAndroid Build Coastguard Worker
1727*912701f9SAndroid Build Coastguard Worker> **Invariants:**
1728*912701f9SAndroid Build Coastguard Worker>
1729*912701f9SAndroid Build Coastguard Worker> * The golden zones are those in mapZone supplemental data under the territory "001".
1730*912701f9SAndroid Build Coastguard Worker> * Every metazone has exactly one golden zone.
1731*912701f9SAndroid Build Coastguard Worker> * Each zone has at most one metazone for which it is golden.
1732*912701f9SAndroid Build Coastguard Worker> * The golden zone is in that metazone during the entire life of the metazone. (The raw offset of the golden zone may change over time.)
1733*912701f9SAndroid Build Coastguard Worker> * Each other zone must have the same raw offset as the golden zone, for the entire period that it is in the metazone. (It might not have the same offset when daylight savings is in effect.)
1734*912701f9SAndroid Build Coastguard Worker> * A golden zone in mapTimezones must have reverse mapping in metazoneInfo.
1735*912701f9SAndroid Build Coastguard Worker> * A single time zone can be a golden zone of multiple different metazones if any two of them are never active at a same time.
1736*912701f9SAndroid Build Coastguard Worker
1737*912701f9SAndroid Build Coastguard Worker**Preferred Zone** - for a given TZID, the "best" zone out of a metazone for a given country or language.
1738*912701f9SAndroid Build Coastguard Worker
1739*912701f9SAndroid Build Coastguard Worker> **Invariants:**
1740*912701f9SAndroid Build Coastguard Worker>
1741*912701f9SAndroid Build Coastguard Worker> * The preferred zone for a given country XX are those in mapZone supplemental data under the territory XX.
1742*912701f9SAndroid Build Coastguard Worker> * Every metazone has at most one preferred zone for a given territory XX.
1743*912701f9SAndroid Build Coastguard Worker> * Each zone has at most one metazone for which it is preferred for a territory XX.
1744*912701f9SAndroid Build Coastguard Worker> * The preferred zone for a given metazone and territory XX is in a metazone M during any time when any other zone in XX is also in M
1745*912701f9SAndroid Build Coastguard Worker> * A preferred zone in mapTimezones must have reverse mapping in metazoneInfo
1746*912701f9SAndroid Build Coastguard Worker
1747*912701f9SAndroid Build Coastguard WorkerFor example, for America_Pacific the preferred zone for Canada is America/Vancouver, and the preferred zone for Mexico is America/Tijuana. The golden zone is America/Los_Angeles, which is also the preferred zone for any other country.
1748*912701f9SAndroid Build Coastguard Worker
1749*912701f9SAndroid Build Coastguard Worker```xml
1750*912701f9SAndroid Build Coastguard Worker<mapZone other="America_Pacific" territory="001" type="America/Los_Angeles" />
1751*912701f9SAndroid Build Coastguard Worker<mapZone other="America_Pacific" territory="CA" type="America/Vancouver" />
1752*912701f9SAndroid Build Coastguard Worker<mapZone other="America_Pacific" territory="MX" type="America/Tijuana" />
1753*912701f9SAndroid Build Coastguard Worker```
1754*912701f9SAndroid Build Coastguard Worker
1755*912701f9SAndroid Build Coastguard Worker**<a name="fallbackFormat" href="#fallbackFormat">fallbackFormat:</a>** a formatting string such as "{1} ({0})", where {1} is the metazone, and {0} is the country or city.
1756*912701f9SAndroid Build Coastguard Worker
1757*912701f9SAndroid Build Coastguard Worker**regionFormat:** a formatting string such as "{0} Time", where {0} is the country or city.
1758*912701f9SAndroid Build Coastguard Worker
1759*912701f9SAndroid Build Coastguard Worker### <a name="Time_Zone_Goals" href="#Time_Zone_Goals">Goals</a>
1760*912701f9SAndroid Build Coastguard Worker
1761*912701f9SAndroid Build Coastguard WorkerThe timezones are designed so that:
1762*912701f9SAndroid Build Coastguard Worker
1763*912701f9SAndroid Build Coastguard Worker> For any given locale, every _time_ round trips with all patterns (but not necessarily every timezone). That is, given a time and a format pattern with a zone string, you can format, then parse, and get back the same time.
1764*912701f9SAndroid Build Coastguard Worker>
1765*912701f9SAndroid Build Coastguard Worker> Note that the round-tripping is not just important for parsing; it provides for formatting dates and times in an unambiguous way for users. It is also important for testing.
1766*912701f9SAndroid Build Coastguard Worker>
1767*912701f9SAndroid Build Coastguard Worker> There are exceptions to the above for transition times.
1768*912701f9SAndroid Build Coastguard Worker>
1769*912701f9SAndroid Build Coastguard Worker> * With generic format, time zone ID or exemplar city name, during the transition when the local time maps to two possible GMT times.
1770*912701f9SAndroid Build Coastguard Worker>   * For example, Java works as follows, favoring standard time:
1771*912701f9SAndroid Build Coastguard Worker>   * Source: Sun Nov 04 01:30:00 PDT 2007
1772*912701f9SAndroid Build Coastguard Worker>   * => Formatted: "Sunday, November 4, 2007 1:30:00 AM"
1773*912701f9SAndroid Build Coastguard Worker>   * => Parsed: Sun Nov 04 01:30:00 PST 2007
1774*912701f9SAndroid Build Coastguard Worker> * When the timezone changes offset, say from GMT+4 to GMT+5, there can also be a gap.
1775*912701f9SAndroid Build Coastguard Worker>
1776*912701f9SAndroid Build Coastguard Worker> The V/VV/VVV/VVVV format will roundtrip not only the time, but the canonical timezone.
1777*912701f9SAndroid Build Coastguard Worker
1778*912701f9SAndroid Build Coastguard WorkerWhen the data for a given format is not available, a fallback format is used. The fallback order is given in the following by a list.
1779*912701f9SAndroid Build Coastguard Worker
1780*912701f9SAndroid Build Coastguard Worker1. **Specifics**
1781*912701f9SAndroid Build Coastguard Worker   * z - [short form] specific non-location
1782*912701f9SAndroid Build Coastguard Worker     * falling back to short localized GMT
1783*912701f9SAndroid Build Coastguard Worker   * zzzz - [long form] specific non-location
1784*912701f9SAndroid Build Coastguard Worker     * falling back to long localized GMT
1785*912701f9SAndroid Build Coastguard Worker   * Z/ZZZZZ/X+/x+ - ISO 8601 formats (no fallback necessary)
1786*912701f9SAndroid Build Coastguard Worker   * ZZZZ/O+ - Localized GMT formats (no fallback necessary)
1787*912701f9SAndroid Build Coastguard Worker
1788*912701f9SAndroid Build Coastguard Worker2. **Generics**
1789*912701f9SAndroid Build Coastguard Worker   * v - [short form] generic non-location
1790*912701f9SAndroid Build Coastguard Worker     _(however, the rules are more complicated, see #5 below)_
1791*912701f9SAndroid Build Coastguard Worker     * falling back to generic location
1792*912701f9SAndroid Build Coastguard Worker     * falling back to short localized GMT
1793*912701f9SAndroid Build Coastguard Worker   * vvvv - [long form] generic non-location
1794*912701f9SAndroid Build Coastguard Worker     _(however, the rules are more complicated, see #5 below)_
1795*912701f9SAndroid Build Coastguard Worker     * falling back to generic location
1796*912701f9SAndroid Build Coastguard Worker     * falling back to long localized GMT
1797*912701f9SAndroid Build Coastguard Worker   * V - short time zone ID
1798*912701f9SAndroid Build Coastguard Worker     * falling back to the special ID "unk" (Unknown)
1799*912701f9SAndroid Build Coastguard Worker   * VV - long time zone ID (no fallback necessary, because this is the input)
1800*912701f9SAndroid Build Coastguard Worker   * VVV - exemplar city
1801*912701f9SAndroid Build Coastguard Worker     * falling back to the localized exemplar city for the unknown zone (Etc/Unknown), for example "Unknown City" for English
1802*912701f9SAndroid Build Coastguard Worker   * VVVV - generic location
1803*912701f9SAndroid Build Coastguard Worker     * falling back to long localized GMT
1804*912701f9SAndroid Build Coastguard Worker
1805*912701f9SAndroid Build Coastguard WorkerThe following process is used for the particular formats, with the fallback rules as above.
1806*912701f9SAndroid Build Coastguard Worker
1807*912701f9SAndroid Build Coastguard WorkerSome of the examples are drawn from real data, while others are for illustration. For illustration the region format is "Hora de {0}". The fallback format in the examples is "{1} ({0})", which is what is in root.
1808*912701f9SAndroid Build Coastguard Worker
1809*912701f9SAndroid Build Coastguard Worker1. In **all** cases, first canonicalize the _TZ_ ID according to the Unicode Locale Extension _type_ mapping data (see [Time Zone Identifiers](tr35.md#Time_Zone_Identifiers) for more details). Use that canonical TZID in each of the following steps.
1810*912701f9SAndroid Build Coastguard Worker   * America/AtkaAmerica/Adak
1811*912701f9SAndroid Build Coastguard Worker   * Australia/ACTAustralia/Sydney
1812*912701f9SAndroid Build Coastguard Worker
1813*912701f9SAndroid Build Coastguard Worker2. For the localized GMT format, use the gmtFormat (such as "GMT{0}" or "HMG{0}") with the hourFormat (such as "+HH:mm;-HH:mm" or "+HH.mm;-HH.mm").
1814*912701f9SAndroid Build Coastguard Worker   * America/Los_Angeles → "GMT-08:00" // standard time
1815*912701f9SAndroid Build Coastguard Worker   * America/Los_Angeles → "HMG-07:00" // daylight time
1816*912701f9SAndroid Build Coastguard Worker   * Etc/GMT+3 → "GMT-03.00" // note that _TZ_ TZIDs have inverse polarity!
1817*912701f9SAndroid Build Coastguard Worker
1818*912701f9SAndroid Build Coastguard Worker    **Note:** The digits should be whatever are appropriate for the locale used to format the time zone, not necessarily from the western digits, 0..9. For example, they might be from ०..९.
1819*912701f9SAndroid Build Coastguard Worker
1820*912701f9SAndroid Build Coastguard Worker3.  For ISO 8601 time zone format return the results according to the ISO 8601 specification.
1821*912701f9SAndroid Build Coastguard Worker    * America/Los_Angeles1822*912701f9SAndroid Build Coastguard Worker      * "-08" ("X","x")
1823*912701f9SAndroid Build Coastguard Worker      * "-0800" ("Z","XX","XXXX","xx","xxxx")
1824*912701f9SAndroid Build Coastguard Worker      * "-08:00" ("ZZZZZ","XXX","XXXXX","xxx","xxxxx")
1825*912701f9SAndroid Build Coastguard Worker    * Etc/GMT1826*912701f9SAndroid Build Coastguard Worker      * "Z" ("ZZZZZ", "X", "XX", "XXX", "XXXX", "XXXXX")
1827*912701f9SAndroid Build Coastguard Worker      * "+00" ("x")
1828*912701f9SAndroid Build Coastguard Worker      * "+0000" ("Z", "xx", "xxxx")
1829*912701f9SAndroid Build Coastguard Worker      * "+00:00" ("xxx", "xxxxx")
1830*912701f9SAndroid Build Coastguard Worker
1831*912701f9SAndroid Build Coastguard Worker    **Note:** The digits in this case are always from the western digits, 0..9.
1832*912701f9SAndroid Build Coastguard Worker
1833*912701f9SAndroid Build Coastguard Worker4. For the non-location formats (generic or specific):
1834*912701f9SAndroid Build Coastguard Worker   1. if there is an explicit translation for the TZID in `<timeZoneNames>` according to type (generic, standard, or daylight) in the resolved locale, return it.
1835*912701f9SAndroid Build Coastguard Worker      1. If the requested type is not available, but another type is, and there is a **Type Fallback** then return that other type.
1836*912701f9SAndroid Build Coastguard Worker         * Examples:
1837*912701f9SAndroid Build Coastguard Worker           * America/Los_Angeles → // generic
1838*912701f9SAndroid Build Coastguard Worker           * America/Los_Angeles → "アメリカ太平洋標準時" // standard
1839*912701f9SAndroid Build Coastguard Worker           * America/Los_Angeles → "Yhdysvaltain Tyynenmeren kesäaika" // daylight
1840*912701f9SAndroid Build Coastguard Worker           * Europe/Dublin  → "Am Samhraidh na hÉireann" // daylight
1841*912701f9SAndroid Build Coastguard Worker           * Note: This translation may not at all be literal: it would be what is most recognizable for people using the target language.
1842*912701f9SAndroid Build Coastguard Worker   2. Otherwise, get the requested metazone format according to type (generic, standard, daylight).
1843*912701f9SAndroid Build Coastguard Worker      1. If the requested type is not available, but another type is, get the format according to **Type Fallback**.
1844*912701f9SAndroid Build Coastguard Worker      2. If there is no format for the type, fall back.
1845*912701f9SAndroid Build Coastguard Worker   3. Otherwise do the following:
1846*912701f9SAndroid Build Coastguard Worker      1. Get the country for the current locale. If there is none, use the most likely country based on the likelySubtags data. If there is none, use “001”.
1847*912701f9SAndroid Build Coastguard Worker      2. Get the preferred zone for the metazone for the country; if there is none for the country, use the preferred zone for the metazone for “001”.
1848*912701f9SAndroid Build Coastguard Worker      3. If that preferred zone is the same as the requested zone, use the metazone format. For example, "Pacific Time" for Vancouver if the locale is en_CA, or for Los Angeles if locale is en_US.
1849*912701f9SAndroid Build Coastguard Worker      4. Otherwise, if the zone is the preferred zone for its country but not for the country of the locale, use the metazone format + country in the _fallbackFormat_.
1850*912701f9SAndroid Build Coastguard Worker      5. Otherwise, use the metazone format + city in the _fallbackFormat_.
1851*912701f9SAndroid Build Coastguard Worker         * Examples:
1852*912701f9SAndroid Build Coastguard Worker           * "Pacific Time (Canada)" // for the zone Vancouver in the locale en_MX.
1853*912701f9SAndroid Build Coastguard Worker           * "Mountain Time (Phoenix)"
1854*912701f9SAndroid Build Coastguard Worker           * "Pacific Time (Whitehorse)"
1855*912701f9SAndroid Build Coastguard Worker5. For the generic location format:
1856*912701f9SAndroid Build Coastguard Worker   1. From the TZDB get the country code for the zone, and determine whether there is only one timezone in the country. If there is only one timezone or if the zone id is in the `<primaryZones>` list, format the country name with the _regionFormat_, and return it.
1857*912701f9SAndroid Build Coastguard Worker      * Examples:
1858*912701f9SAndroid Build Coastguard Worker        * Europe/Rome → IT → "Italy Time" // for English
1859*912701f9SAndroid Build Coastguard Worker        * Asia/Shanghai → CN → "China Time" // Asia/Shanghai is the _primaryZone_ for China
1860*912701f9SAndroid Build Coastguard Worker        * Africa/Monrovia → LR → "Hora de Liberja"
1861*912701f9SAndroid Build Coastguard Worker        * America/Havana → CU → "Hora de CU" // if CU is not localized
1862*912701f9SAndroid Build Coastguard Worker   2. Otherwise format the exemplar city with the _regionFormat_, and return it.
1863*912701f9SAndroid Build Coastguard Worker      1. America/Buenos_Aires → "Buenos Aires Time"
1864*912701f9SAndroid Build Coastguard Worker
1865*912701f9SAndroid Build Coastguard Worker> **Note:** If a language does require grammatical changes when composing strings, then the _regionFormat_ should either use a neutral format such as "Heure: {0}", or put all exceptional cases in explicitly translated strings.
1866*912701f9SAndroid Build Coastguard Worker
1867*912701f9SAndroid Build Coastguard Worker**Type Fallback**
1868*912701f9SAndroid Build Coastguard Worker
1869*912701f9SAndroid Build Coastguard WorkerWhen a specified type (generic, standard, daylight) does not exist:
1870*912701f9SAndroid Build Coastguard Worker
1871*912701f9SAndroid Build Coastguard Worker1. If the daylight type does not exist, then the metazone doesn’t require daylight support. For all three types:
1872*912701f9SAndroid Build Coastguard Worker   1. If the generic type exists, use it.
1873*912701f9SAndroid Build Coastguard Worker   2. Otherwise if the standard type exists, use it.
1874*912701f9SAndroid Build Coastguard Worker2. Otherwise if the generic type is needed, but not available, and the offset and daylight offset do not change within 184 day +/- interval around the exact formatted time, use the standard type.
1875*912701f9SAndroid Build Coastguard Worker   1. Example: "Mountain Standard Time" for Phoenix
1876*912701f9SAndroid Build Coastguard Worker   2. Note: 184 is the smallest number that is at least 6 months AND the smallest number that is more than 1/2 year (Gregorian).
1877*912701f9SAndroid Build Coastguard Worker
1878*912701f9SAndroid Build Coastguard Worker**Composition**
1879*912701f9SAndroid Build Coastguard Worker
1880*912701f9SAndroid Build Coastguard WorkerIn composing the metazone + city or country:
1881*912701f9SAndroid Build Coastguard Worker
1882*912701f9SAndroid Build Coastguard Worker1. Use the _fallbackFormat_ "{1} ({0})", where:
1883*912701f9SAndroid Build Coastguard Worker   * {1} will be the metazone
1884*912701f9SAndroid Build Coastguard Worker   * {0} will be a qualifier (city or country)
1885*912701f9SAndroid Build Coastguard Worker   * Example:
1886*912701f9SAndroid Build Coastguard Worker     * metazone = Pacific Time
1887*912701f9SAndroid Build Coastguard Worker     * city = Phoenix
1888*912701f9SAndroid Build Coastguard Worker     * → "Pacific Time (Phoenix)"
1889*912701f9SAndroid Build Coastguard Worker2. If the localized country name is not available, use the code:
1890*912701f9SAndroid Build Coastguard Worker   * CU (country code) → "CU" _// no localized country name for Cuba_
1891*912701f9SAndroid Build Coastguard Worker3. If the localized exemplar city is not available, use as the exemplar city the last field of the raw TZID, stripping off the prefix and turning _ into space.
1892*912701f9SAndroid Build Coastguard Worker   * America/Los_Angeles → "Los Angeles" _// no localized exemplar city_
1893*912701f9SAndroid Build Coastguard Worker
1894*912701f9SAndroid Build Coastguard Worker**Note:** As with the _regionFormat_, exceptional cases need to be explicitly translated.
1895*912701f9SAndroid Build Coastguard Worker
1896*912701f9SAndroid Build Coastguard Worker### <a name="Time_Zone_Parsing" href="#Time_Zone_Parsing">Parsing</a>
1897*912701f9SAndroid Build Coastguard Worker
1898*912701f9SAndroid Build Coastguard WorkerIn parsing, an implementation will be able to either determine the zone id, or a simple offset from GMT for anything formatting according to the above process.
1899*912701f9SAndroid Build Coastguard Worker
1900*912701f9SAndroid Build Coastguard WorkerThe following is a sample process for how this might be done. It is only a sample; implementations may use different methods for parsing.
1901*912701f9SAndroid Build Coastguard Worker
1902*912701f9SAndroid Build Coastguard WorkerThe sample describes the parsing of a zone as if it were an isolated string. In implementations, the zone may be mixed in with other data (like the time), so the parsing actually has to look for the longest match, and then allow the remaining text to be parsed for other content. That requires certain adaptions to the following process.
1903*912701f9SAndroid Build Coastguard Worker
1904*912701f9SAndroid Build Coastguard Worker1. Start with a string S.
1905*912701f9SAndroid Build Coastguard Worker2. If S matches ISO 8601 time zone format, return it.
1906*912701f9SAndroid Build Coastguard Worker   * For example, "-0800" (RFC 822), "-08:00" (ISO 8601) => Etc/GMT+8
1907*912701f9SAndroid Build Coastguard Worker3. If S matches the English or localized GMT format, return the corresponding TZID
1908*912701f9SAndroid Build Coastguard Worker   * Matching should be lenient. Thus allow for the number formats like: 03, 3, 330, 3:30, 33045 or 3:30:45. Allow +, -, or nothing. Allow spaces after GMT, +/-, and before number. Allow non-Latin numbers. Allow UTC or UT (per RFC 788) as synonyms for GMT ("GMT", "UT", "UTC" are global formats, always allowed in parsing regardless of locale).
1909*912701f9SAndroid Build Coastguard Worker   * For example, "GMT+3" or "UT+3" or "HPG+3" => Etc/GMT-3
1910*912701f9SAndroid Build Coastguard Worker   * When parsing, the absence of a numeric offset should be interpreted as offset 0, whether in localized or global formats. For example, "GMT" or "UT" or "UTC+0" or "HPG" => Etc/GMT
1911*912701f9SAndroid Build Coastguard Worker4. If S matches the fallback format, extract P = {0} [ie, the part in parens in the root format] and N = {1}.
1912*912701f9SAndroid Build Coastguard Worker   If S does not match, set P = "" and N = S.
1913*912701f9SAndroid Build Coastguard Worker   If N matches the region format, then M = {0} from that format, otherwise M = N.
1914*912701f9SAndroid Build Coastguard Worker   * For example, "United States (Los Angeles) Time" => N = "United States Time", M = "United States", P = "Los Angeles".
1915*912701f9SAndroid Build Coastguard Worker   * For example, "United States Time" => N = "United States Time", M = "United States", P = "".
1916*912701f9SAndroid Build Coastguard Worker   * For example, "United States" => N = M = "United States", P = "".
1917*912701f9SAndroid Build Coastguard Worker5. If P, N, or M is a localized country, set C to that value. If C has only one zone, return it.
1918*912701f9SAndroid Build Coastguard Worker   * For example, "Italy Time (xxx)" or "xxx (Italy)" => Europe/Rome
1919*912701f9SAndroid Build Coastguard Worker   * For example, "xxx (Canada)" or "Canada Time (xxx)" => Sets C = CA and continues
1920*912701f9SAndroid Build Coastguard Worker6. If P is a localized exemplar city name (and not metazone), return it.
1921*912701f9SAndroid Build Coastguard Worker   * For example, "xxxx (Phoenix)" or "Phoenix (xxx)" => America/Phoenix
1922*912701f9SAndroid Build Coastguard Worker7. If N, or M is a localized time zone name (and not metazone), return it.
1923*912701f9SAndroid Build Coastguard Worker   * For example, "Pacific Standard Time (xxx)" => "America/Los_Angeles" // this is only if "Pacific Standard Time" is not a metazone localization.
1924*912701f9SAndroid Build Coastguard Worker8. If N or M is a localized metazone
1925*912701f9SAndroid Build Coastguard Worker   * If it corresponds to only one TZID, return it.
1926*912701f9SAndroid Build Coastguard Worker   * If C is set, look up the Metazone + Country => TZID mapping, and return that value if it exists
1927*912701f9SAndroid Build Coastguard Worker   * Get the locale's language, and get the default country from that. Look up the Metazone + DefaultCountry => TZID mapping, and return that value if it exists.
1928*912701f9SAndroid Build Coastguard Worker   * Otherwise, look up Metazone + 001 => TZID and return it (that will always exist)
1929*912701f9SAndroid Build Coastguard Worker9. If you get this far, return an error.
1930*912701f9SAndroid Build Coastguard Worker
1931*912701f9SAndroid Build Coastguard Worker> **Note:** This CLDR date parsing recommendation does not fully handle all RFC 788 date/time formats, nor is it intended to.
1932*912701f9SAndroid Build Coastguard Worker
1933*912701f9SAndroid Build Coastguard WorkerParsing can be more lenient than the above, allowing for different spacing, punctuation, or other variation. A stricter parse would check for consistency between the xxx portions above and the rest, so "Pacific Standard Time (India)" would give an error.
1934*912701f9SAndroid Build Coastguard Worker
1935*912701f9SAndroid Build Coastguard WorkerUsing this process, a correct parse will roundtrip the location format (VVVV) back to the canonical zoneid.
1936*912701f9SAndroid Build Coastguard Worker
1937*912701f9SAndroid Build Coastguard Worker  * Australia/ACTAustralia/Sydney → “Sydney (Australia)” → Australia/Sydney
1938*912701f9SAndroid Build Coastguard Worker
1939*912701f9SAndroid Build Coastguard WorkerThe GMT formats (Z and ZZZZ) will return back an offset, and thus lose the original canonical zone id.
1940*912701f9SAndroid Build Coastguard Worker
1941*912701f9SAndroid Build Coastguard Worker  * Australia/ACTAustralia/Sydney → "GMT+11:00" → GMT+11
1942*912701f9SAndroid Build Coastguard Worker
1943*912701f9SAndroid Build Coastguard WorkerThe daylight and standard time formats, and the non-location formats (z, zzzz, v, and vvvv) may either roundtrip back to the original canonical zone id, to a zone in the same metazone that time, or to just an offset, depending on the available translation data. Thus:
1944*912701f9SAndroid Build Coastguard Worker
1945*912701f9SAndroid Build Coastguard Worker  * Australia/ACTAustralia/Sydney → "GMT+11:00" → GMT+11
1946*912701f9SAndroid Build Coastguard Worker  * PST8PDT → America/Los_Angeles → “PST” → America/Los_Angeles
1947*912701f9SAndroid Build Coastguard Worker  * America/Vancouver → “Pacific Time (Canada)” → America/Vancouver
1948*912701f9SAndroid Build Coastguard Worker
1949*912701f9SAndroid Build Coastguard Worker## <a name="Date_Format_Patterns" href="#Date_Format_Patterns">Date Format Patterns</a>
1950*912701f9SAndroid Build Coastguard Worker
1951*912701f9SAndroid Build Coastguard WorkerA date pattern is a character string consisting of two types of elements:
1952*912701f9SAndroid Build Coastguard Worker
1953*912701f9SAndroid Build Coastguard Worker* _Pattern fields_, which repeat a specific _pattern character_ one or more times. These fields are replaced with date and time data from a calendar when formatting, or used to generate data for a calendar when parsing. Currently, A..Z and a..z are reserved for use as pattern characters (unless they are quoted, see next item). The pattern characters currently defined, and the meaning of different fields lengths for then, are listed in the Date Field Symbol Table below.
1954*912701f9SAndroid Build Coastguard Worker* Literal text, which is output as-is when formatting, and must closely match when parsing. Literal text can include:
1955*912701f9SAndroid Build Coastguard Worker  * Any characters other than A..Z and a..z, including spaces and punctuation.
1956*912701f9SAndroid Build Coastguard Worker  * Any text between single vertical quotes ('xxxx'), which may include A..Z and a..z as literal text.
1957*912701f9SAndroid Build Coastguard Worker  * Two adjacent single vertical quotes (''), which represent a literal single quote, either inside or outside quoted text.
1958*912701f9SAndroid Build Coastguard Worker
1959*912701f9SAndroid Build Coastguard WorkerThe following are examples:
1960*912701f9SAndroid Build Coastguard Worker
1961*912701f9SAndroid Build Coastguard Worker###### Table: <a name="Date_Format_Pattern_Examples" href="#Date_Format_Pattern_Examples">Date Format Pattern Examples</a>
1962*912701f9SAndroid Build Coastguard Worker
1963*912701f9SAndroid Build Coastguard Worker| Pattern | Result (in a particular locale) |
1964*912701f9SAndroid Build Coastguard Worker| ------- | ------------------------------- |
1965*912701f9SAndroid Build Coastguard Worker| yyyy.MM.dd G 'at' HH:mm:ss zzz | 1996.07.10 AD at 15:08:56 PDT |
1966*912701f9SAndroid Build Coastguard Worker| EEE, MMM d, ''yy | Wed, July 10, '96 |
1967*912701f9SAndroid Build Coastguard Worker| h:mm a | 12:08 PM |
1968*912701f9SAndroid Build Coastguard Worker| hh 'o''clock' a, zzzz | 12 o'clock PM, Pacific Daylight Time |
1969*912701f9SAndroid Build Coastguard Worker| K:mm a, z | 0:00 PM, PST |
1970*912701f9SAndroid Build Coastguard Worker| yyyyy.MMMM.dd GGG hh:mm aaa | 01996.July.10 AD 12:08 PM |
1971*912701f9SAndroid Build Coastguard Worker
1972*912701f9SAndroid Build Coastguard Worker_When parsing using a pattern, a lenient parse should be used; see [Parsing Dates and Times](#Parsing_Dates_Times)._
1973*912701f9SAndroid Build Coastguard Worker
1974*912701f9SAndroid Build Coastguard Worker```xml
1975*912701f9SAndroid Build Coastguard Worker<!ATTLIST pattern numbers CDATA #IMPLIED >
1976*912701f9SAndroid Build Coastguard Worker```
1977*912701f9SAndroid Build Coastguard Worker
1978*912701f9SAndroid Build Coastguard WorkerThe `numbers` attribute is used to indicate that numeric quantities in the pattern are to be rendered using a numbering system other than the default numbering system defined for the given locale. The attribute can be in one of two forms. If the alternate numbering system is intended to apply to ALL numeric quantities in the pattern, then simply use the numbering system ID as found in [Numbering Systems](tr35-numbers.md#Numbering_Systems). To apply the alternate numbering system only to a single field, the syntax `<letter>=<numberingSystem>` can be used one or more times, separated by semicolons.
1979*912701f9SAndroid Build Coastguard Worker
1980*912701f9SAndroid Build Coastguard WorkerExamples:
1981*912701f9SAndroid Build Coastguard Worker
1982*912701f9SAndroid Build Coastguard Worker```xml
1983*912701f9SAndroid Build Coastguard Worker<pattern numbers="hebr">dd/mm/yyyy</pattern>
1984*912701f9SAndroid Build Coastguard Worker<!-- Use Hebrew numerals to represent numbers in the Hebrew calendar, where "latn" numbering system is the default -->
1985*912701f9SAndroid Build Coastguard Worker
1986*912701f9SAndroid Build Coastguard Worker<pattern numbers="y=hebr">dd/mm/yyyy</pattern>
1987*912701f9SAndroid Build Coastguard Worker<!-- Same as above, except that ONLY the year value would be rendered in Hebrew -->
1988*912701f9SAndroid Build Coastguard Worker
1989*912701f9SAndroid Build Coastguard Worker<pattern numbers="d=thai;m=hans;y=deva">dd/mm/yyyy</pattern>
1990*912701f9SAndroid Build Coastguard Worker<!-- Illustrates use of multiple numbering systems for a single pattern. -->
1991*912701f9SAndroid Build Coastguard Worker```
1992*912701f9SAndroid Build Coastguard Worker
1993*912701f9SAndroid Build Coastguard Worker**Pattern fields and the Date Field Symbol Table**
1994*912701f9SAndroid Build Coastguard Worker
1995*912701f9SAndroid Build Coastguard WorkerThe Date Field Symbol Table below shows the pattern characters (Sym.) and associated fields used in date patterns. The length of the pattern field is related to the length and style used to format the data item. For numeric-only fields, the field length typically indicates the minimum number of digits that should be used to display the value (zero-padding as necessary). As an example using pattern character ‘H’ for hour (24-hour cycle) and values 5 and 11, a field “H” should produce formatted results “5” and “11” while a field “HH” should produce formatted results “05” and “11”. For alphanumeric fields (such as months) and alphabetic-only fields (such as era names), the relationship between field length and formatted result may be more complex. Typically this is as follows:
1996*912701f9SAndroid Build Coastguard Worker
1997*912701f9SAndroid Build Coastguard Worker<!-- HTML: spanned rows, spanned columns -->
1998*912701f9SAndroid Build Coastguard Worker <table>
1999*912701f9SAndroid Build Coastguard Worker    <tr><th>Pattern field length</th><th>Typical style, alphanumeric item</th><th>Typical style, alpha-only item</th></tr>
2000*912701f9SAndroid Build Coastguard Worker    <tr><td>1</td><td>Numeric, 1-2 digits (e.g. M)</td><td rowspan="3">Abbreviated (e.g. E, EE, EEE)</td></tr>
2001*912701f9SAndroid Build Coastguard Worker    <tr><td>2</td><td>Numeric, 2 digits (e.g. MM)</td></tr>
2002*912701f9SAndroid Build Coastguard Worker    <tr><td>3</td><td>Abbreviated (e.g. MMM)</td></tr>
2003*912701f9SAndroid Build Coastguard Worker    <tr><td>4</td><td colspan="2">Wide / Long / Full (e.g. MMMM, EEEE)</td></tr>
2004*912701f9SAndroid Build Coastguard Worker    <tr><td>5</td><td colspan="2">Narrow (e.g. MMMMM, EEEEE)<br/>(The counter-intuitive use of 5 letters for this is forced by backwards compatibility)</td></tr>
2005*912701f9SAndroid Build Coastguard Worker    <tr><td>&gt;16</td><td colspan="2">Private Use<br/>(Reserved for use by implementations using CLDR; will never be otherwise used by CLDR.)</td></tr>
2006*912701f9SAndroid Build Coastguard Worker</table>
2007*912701f9SAndroid Build Coastguard Worker
2008*912701f9SAndroid Build Coastguard WorkerNotes for the table below:
2009*912701f9SAndroid Build Coastguard Worker
2010*912701f9SAndroid Build Coastguard Worker* Any sequence of pattern characters other than those listed below is invalid. Invalid pattern fields should be handled for formatting and parsing as described in [Handling Invalid Patterns](tr35.md#Invalid_Patterns).
2011*912701f9SAndroid Build Coastguard Worker* The examples in the table below are merely illustrative and may not reflect current actual data.
2012*912701f9SAndroid Build Coastguard Worker
2013*912701f9SAndroid Build Coastguard Worker###### Table: <a name="Date_Field_Symbol_Table" href="#Date_Field_Symbol_Table">Date Field Symbol Table</a>
2014*912701f9SAndroid Build Coastguard Worker
2015*912701f9SAndroid Build Coastguard Worker<!-- HTML: spanned rows, spanned columns, vertical header cells -->
2016*912701f9SAndroid Build Coastguard Worker<table><tbody>
2017*912701f9SAndroid Build Coastguard Worker<tr><th>Field<br/>Type</th><th>Sym.</th><th>Field<br/>Patterns</th><th>Examples</th><th colspan="2">Description</th></tr>
2018*912701f9SAndroid Build Coastguard Worker
2019*912701f9SAndroid Build Coastguard Worker<!-- == == == ERA == == == -->
2020*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="3"><a name="dfst-era" href="#dfst-era">era</a></th><td rowspan="3">G</td><td>G..GGG</td><td>AD<br/>[variant: CE]</td><td>Abbreviated</td><td rowspan="3">Era name. Era string for the current date.</td></tr>
2021*912701f9SAndroid Build Coastguard Worker    <tr><td>GGGG</td><td>Anno Domini<br/>[variant: Common Era]</td><td>Wide</td></tr>
2022*912701f9SAndroid Build Coastguard Worker    <tr><td>GGGGG</td><td>A</td><td>Narrow</td></tr>
2023*912701f9SAndroid Build Coastguard Worker
2024*912701f9SAndroid Build Coastguard Worker<!-- == == == YEAR == == == -->
2025*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="15"><a name="dfst-year" href="#dfst-year">year</a><a name="Year_Length_Examples"></a></th><td rowspan="5">y</td><td>y</td><td>2, 20, 201, 2017, 20173</td>
2026*912701f9SAndroid Build Coastguard Worker        <td rowspan="5" colspan="2">Calendar year (numeric). In most cases the length of the y field specifies the minimum number of digits to display, zero-padded as necessary; more digits will be displayed if needed to show the full year.
2027*912701f9SAndroid Build Coastguard Worker                                    However, “yy” requests just the two low-order digits of the year, zero-padded as necessary. For most use cases, “y” or “yy” should be adequate.</td></tr>
2028*912701f9SAndroid Build Coastguard Worker    <tr><td>yy</td><td>02, 20, 01, 17, 73</td></tr>
2029*912701f9SAndroid Build Coastguard Worker    <tr><td>yyy</td><td>002, 020, 201, 2017, 20173</td></tr>
2030*912701f9SAndroid Build Coastguard Worker    <tr><td>yyyy</td><td>0002, 0020, 0201, 2017, 20173</td></tr>
2031*912701f9SAndroid Build Coastguard Worker    <tr><td>yyyyy+</td><td>...</td></tr>
2032*912701f9SAndroid Build Coastguard Worker    <!--  Y  -->
2033*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="5">Y</td><td>Y</td><td>2, 20, 201, 2017, 20173</td>
2034*912701f9SAndroid Build Coastguard Worker        <td rowspan="5" colspan="2">Year in “Week of Year” based calendars in which the year transition occurs on a week boundary; may differ from calendar year ‘y’ near a year transition.
2035*912701f9SAndroid Build Coastguard Worker                                    This numeric year designation is used in conjunction with pattern character ‘w’ in the ISO year-week calendar as defined by ISO 8601, but can be used in non-Gregorian based calendar systems where week date processing is desired.
2036*912701f9SAndroid Build Coastguard Worker                                    The field length is interpreted in the same was as for ‘y’; that is, “yy” specifies use of the two low-order year digits, while any other field length specifies a minimum number of digits to display.</td></tr>
2037*912701f9SAndroid Build Coastguard Worker    <tr><td>YY</td><td>02, 20, 01, 17, 73</td></tr>
2038*912701f9SAndroid Build Coastguard Worker    <tr><td>YYY</td><td>002, 020, 201, 2017, 20173</td></tr>
2039*912701f9SAndroid Build Coastguard Worker    <tr><td>YYYY</td><td>0002, 0020, 0201, 2017, 20173</td></tr>
2040*912701f9SAndroid Build Coastguard Worker    <tr><td>YYYYY+</td><td>...</td></tr>
2041*912701f9SAndroid Build Coastguard Worker    <!--  u  -->
2042*912701f9SAndroid Build Coastguard Worker    <tr><td>u</td><td>u+</td><td>4601</td>
2043*912701f9SAndroid Build Coastguard Worker        <td colspan="2">Extended year (numeric). This is a single number designating the year of this calendar system, encompassing all supra-year fields.
2044*912701f9SAndroid Build Coastguard Worker                        For example, for the Julian calendar system, year numbers are positive, with an era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE years and negative values to BCE years, with 1 BCE being year 0.
2045*912701f9SAndroid Build Coastguard Worker                        For ‘u’, all field lengths specify a minimum number of digits; there is no special interpretation for “uu”.</td></tr>
2046*912701f9SAndroid Build Coastguard Worker    <!--  U  -->
2047*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="3">U</td><td>U..UUU</td><td>甲子</td><td>Abbreviated</td>
2048*912701f9SAndroid Build Coastguard Worker        <td rowspan="3">Cyclic year name. Calendars such as the Chinese lunar calendar (and related calendars) and the Hindu calendars use 60-year cycles of year names.
2049*912701f9SAndroid Build Coastguard Worker                        If the calendar does not provide cyclic year name data, or if the year value to be formatted is out of the range of years for which cyclic name data is provided, then numeric formatting is used (behaves like 'y').<br/>
2050*912701f9SAndroid Build Coastguard Worker                        Currently the data only provides abbreviated names, which will be used for all requested name widths.</td></tr>
2051*912701f9SAndroid Build Coastguard Worker    <tr><td>UUUU</td><td>甲子 [for now]</td><td>Wide</td></tr>
2052*912701f9SAndroid Build Coastguard Worker    <tr><td>UUUUU</td><td>甲子 [for now]</td><td>Narrow</td></tr>
2053*912701f9SAndroid Build Coastguard Worker    <!--  r  -->
2054*912701f9SAndroid Build Coastguard Worker    <tr><td>r</td><td>r+</td><td>2017</td>
2055*912701f9SAndroid Build Coastguard Worker        <td colspan="2">Related Gregorian year (numeric).
2056*912701f9SAndroid Build Coastguard Worker                        For non-Gregorian calendars, this corresponds to the extended Gregorian year in which the calendar’s year begins.
2057*912701f9SAndroid Build Coastguard Worker                        Related Gregorian years are often displayed, for example, when formatting dates in the Japanese calendar — e.g. “2012(平成24)年1月15日” — or in the Chinese calendar — e.g. “2012壬辰年腊月初四”.
2058*912701f9SAndroid Build Coastguard Worker                        The related Gregorian year is usually displayed using the "latn" numbering system, regardless of what numbering systems may be used for other parts of the formatted date.
2059*912701f9SAndroid Build Coastguard Worker                        If the calendar’s year is linked to the solar year (perhaps using leap months), then for that calendar the ‘r’ year will always be at a fixed offset from the ‘u’ year.
2060*912701f9SAndroid Build Coastguard Worker                        For the Gregorian calendar, the ‘r’ year is the same as the ‘u’ year. For ‘r’, all field lengths specify a minimum number of digits; there is no special interpretation for “rr”.</td></tr>
2061*912701f9SAndroid Build Coastguard Worker
2062*912701f9SAndroid Build Coastguard Worker<!-- == == == QUARTER == == == -->
2063*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="10"><a name="dfst-quarter" id="dfst-quarter" href="#dfst-quarter">quarter</a></th><td rowspan="5">Q</td><td>Q</td><td>2</td><td>Numeric: 1 digit</td><td rowspan="5">Quarter number/name.</td></tr>
2064*912701f9SAndroid Build Coastguard Worker    <tr><td>QQ</td><td>02</td><td>Numeric: 2 digits + zero pad</td></tr>
2065*912701f9SAndroid Build Coastguard Worker    <tr><td>QQQ</td><td>Q2</td><td>Abbreviated</td></tr>
2066*912701f9SAndroid Build Coastguard Worker    <tr><td>QQQQ</td><td>2nd quarter</td><td>Wide</td></tr>
2067*912701f9SAndroid Build Coastguard Worker    <tr><td>QQQQQ</td><td>2</td><td>Narrow</td></tr>
2068*912701f9SAndroid Build Coastguard Worker    <!--  q  -->
2069*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="5">q</td><td>q</td><td>2</td><td>Numeric: 1 digit</td><td rowspan="5"><b>Stand-Alone</b> Quarter number/name.</td></tr>
2070*912701f9SAndroid Build Coastguard Worker    <tr><td>qq</td><td>02</td><td>Numeric: 2 digits + zero pad</td></tr>
2071*912701f9SAndroid Build Coastguard Worker    <tr><td>qqq</td><td>Q2</td><td>Abbreviated</td></tr>
2072*912701f9SAndroid Build Coastguard Worker    <tr><td>qqqq</td><td>2nd quarter</td><td>Wide</td></tr>
2073*912701f9SAndroid Build Coastguard Worker    <tr><td>qqqqq</td><td>2</td><td>Narrow</td></tr>
2074*912701f9SAndroid Build Coastguard Worker
2075*912701f9SAndroid Build Coastguard Worker<!-- == == == MONTH == == == -->
2076*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="11"><a name="dfst-month" id="dfst-month" href="#dfst-month">month</a></th><td rowspan="5">M</td><td>M</td><td>9, 12</td><td>Numeric: minimum digits</td><td rowspan="5"><b>Format</b> style month number/name: The format style name is an additional form of the month name (besides the stand-alone style) that can be used in contexts where it is different than the stand-alone form. For example, depending on the language, patterns that combine month with day-of month (e.g. "d MMMM") may require the month to be in genitive form. See discussion of <a href="#months_days_quarters_eras">month element</a>. If a separate form is not needed, the format and stand-alone forms can be the same.</td></tr>
2077*912701f9SAndroid Build Coastguard Worker    <tr><td>MM</td><td>09, 12</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2078*912701f9SAndroid Build Coastguard Worker    <tr><td>MMM</td><td>Sep</td><td>Abbreviated</td></tr>
2079*912701f9SAndroid Build Coastguard Worker    <tr><td>MMMM</td><td>September</td><td>Wide</td></tr>
2080*912701f9SAndroid Build Coastguard Worker    <tr><td>MMMMM</td><td>S</td><td>Narrow</td></tr>
2081*912701f9SAndroid Build Coastguard Worker    <!--  L  -->
2082*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="5">L</td><td>L</td><td>9, 12</td><td>Numeric: minimum digits</td><td rowspan="5"><b>Stand-Alone</b> month number/name: For use when the month is displayed by itself, and in any other date pattern (e.g. just month and year, e.g. "LLLL y") that shares the same form of the month name. For month names, this is typically the nominative form. See discussion of <a href="#months_days_quarters_eras">month element</a>.</td></tr>
2083*912701f9SAndroid Build Coastguard Worker    <tr><td>LL</td><td>09, 12</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2084*912701f9SAndroid Build Coastguard Worker    <tr><td>LLL</td><td>Sep</td><td>Abbreviated</td></tr>
2085*912701f9SAndroid Build Coastguard Worker    <tr><td>LLLL</td><td>September</td><td>Wide</td></tr>
2086*912701f9SAndroid Build Coastguard Worker    <tr><td>LLLLL</td><td>S</td><td>Narrow</td></tr>
2087*912701f9SAndroid Build Coastguard Worker    <!--  l  -->
2088*912701f9SAndroid Build Coastguard Worker    <tr><td>l</td><td>l</td><td>[nothing]</td>
2089*912701f9SAndroid Build Coastguard Worker        <td colspan="2">This pattern character is deprecated, and should be ignored in patterns.
2090*912701f9SAndroid Build Coastguard Worker                        It was originally intended to be used in combination with M to indicate placement of the symbol for leap month in the Chinese calendar.
2091*912701f9SAndroid Build Coastguard Worker                        Placement of that marker is now specified using locale-specific &lt;monthPatterns&gt; data, and formatting and parsing of that marker should be handled as part of supporting the regular M and L pattern characters.</td></tr>
2092*912701f9SAndroid Build Coastguard Worker
2093*912701f9SAndroid Build Coastguard Worker<!-- == == == WEEK == == == -->
2094*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="3"><a name="dfst-week" id="dfst-week" href="#dfst-week">week</a></th><td rowspan="2">w</td><td>w</td><td>8, 27</td><td>Numeric: minimum digits</td><td rowspan="2">Week of Year (numeric). When used in a pattern with year, use ‘Y’ for the year field instead of ‘y’.</td></tr>
2095*912701f9SAndroid Build Coastguard Worker    <tr><td>ww</td><td>08, 27</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2096*912701f9SAndroid Build Coastguard Worker    <!--  W  -->
2097*912701f9SAndroid Build Coastguard Worker    <tr><td>W</td><td>W</td><td>3</td><td>Numeric: 1 digit</td><td>Week of Month (numeric)</td></tr>
2098*912701f9SAndroid Build Coastguard Worker
2099*912701f9SAndroid Build Coastguard Worker<!-- == == == DAY == == == -->
2100*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="5"><a name="dfst-day" id="dfst-day" href="#dfst-day">day</a></th><td rowspan="2">d</td><td>d</td><td>1</td><td>Numeric: minimum digits</td><td rowspan="2">Day of month (numeric).</td></tr>
2101*912701f9SAndroid Build Coastguard Worker    <tr><td>dd</td><td>01</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2102*912701f9SAndroid Build Coastguard Worker    <tr><td>D</td><td>D...DDD</td><td>345</td><td colspan="2">Day of year (numeric). The field length specifies the minimum number of digits, with zero-padding as necessary.</td></tr>
2103*912701f9SAndroid Build Coastguard Worker    <tr><td>F</td><td>F</td><td>2</td><td colspan="2">Day of Week in Month (numeric). The example is for the 2nd Wed in July</td></tr>
2104*912701f9SAndroid Build Coastguard Worker    <tr><td>g</td><td>g+</td><td>2451334</td>
2105*912701f9SAndroid Build Coastguard Worker        <td colspan="2">Modified Julian day (numeric).
2106*912701f9SAndroid Build Coastguard Worker                        This is different from the conventional Julian day number in two regards.
2107*912701f9SAndroid Build Coastguard Worker                        First, it demarcates days at local zone midnight, rather than noon GMT.
2108*912701f9SAndroid Build Coastguard Worker                        Second, it is a local number; that is, it depends on the local time zone.
2109*912701f9SAndroid Build Coastguard Worker                        It can be thought of as a single number that encompasses all the date-related fields.
2110*912701f9SAndroid Build Coastguard Worker                        The field length specifies the minimum number of digits, with zero-padding as necessary.</td></tr>
2111*912701f9SAndroid Build Coastguard Worker
2112*912701f9SAndroid Build Coastguard Worker<!-- == == == WEEKDAY == == == -->
2113*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="15"><a name="dfst-weekday" id="dfst-weekday" href="#dfst-weekday">week<br/>day</a></th><td rowspan="4">E</td><td>E..EEE</td><td>Tue</td><td>Abbreviated</td><td rowspan="4">Day of week name, format style.</td></tr>
2114*912701f9SAndroid Build Coastguard Worker    <tr><td>EEEE</td><td>Tuesday</td><td>Wide</td></tr>
2115*912701f9SAndroid Build Coastguard Worker    <tr><td>EEEEE</td><td>T</td><td>Narrow</td></tr>
2116*912701f9SAndroid Build Coastguard Worker    <tr><td>EEEEEE</td><td>Tu</td><td>Short</td></tr>
2117*912701f9SAndroid Build Coastguard Worker    <!--  e  -->
2118*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="6">e</td><td>e</td><td>2</td><td>Numeric: 1 digit</td>
2119*912701f9SAndroid Build Coastguard Worker        <td rowspan="6">Local day of week number/name, format style.
2120*912701f9SAndroid Build Coastguard Worker                        Same as E except adds a numeric value that will depend on the local starting day of the week.
2121*912701f9SAndroid Build Coastguard Worker                        For this example, Monday is the first day of the week.</td></tr>
2122*912701f9SAndroid Build Coastguard Worker    <tr><td>ee</td><td>02</td><td>Numeric: 2 digits + zero pad</td></tr>
2123*912701f9SAndroid Build Coastguard Worker    <tr><td>eee</td><td>Tue</td><td>Abbreviated</td></tr>
2124*912701f9SAndroid Build Coastguard Worker    <tr><td>eeee</td><td>Tuesday</td><td>Wide</td></tr>
2125*912701f9SAndroid Build Coastguard Worker    <tr><td>eeeee</td><td>T</td><td>Narrow</td></tr>
2126*912701f9SAndroid Build Coastguard Worker    <tr><td>eeeeee</td><td>Tu</td><td>Short</td></tr>
2127*912701f9SAndroid Build Coastguard Worker    <!--  c  -->
2128*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="5">c</td><td>c..cc</td><td>2</td><td>Numeric: 1 digit</td><td rowspan="5"><b>Stand-Alone</b> local day of week number/name.</td></tr>
2129*912701f9SAndroid Build Coastguard Worker    <tr><td>ccc</td><td>Tue</td><td>Abbreviated</td></tr>
2130*912701f9SAndroid Build Coastguard Worker    <tr><td>cccc</td><td>Tuesday</td><td>Wide</td></tr>
2131*912701f9SAndroid Build Coastguard Worker    <tr><td>ccccc</td><td>T</td><td>Narrow</td></tr>
2132*912701f9SAndroid Build Coastguard Worker    <tr><td>cccccc</td><td>Tu</td><td>Short</td></tr>
2133*912701f9SAndroid Build Coastguard Worker
2134*912701f9SAndroid Build Coastguard Worker<!-- == == == PERIOD == == == -->
2135*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="9"><a name="dfst-period" id="dfst-period" href="#dfst-period">period</a></th><td rowspan="3">a</td><td>a..aaa</td><td>am. [e.g. 12 am.]</td><td>Abbreviated</td>
2136*912701f9SAndroid Build Coastguard Worker        <td rowspan="3"><strong>AM, PM<br/></strong>May be upper or lowercase depending on the locale and other options.
2137*912701f9SAndroid Build Coastguard Worker                                                    The wide form may be the same as the short form if the “real” long form (eg <em>ante meridiem</em>) is not customarily used.
2138*912701f9SAndroid Build Coastguard Worker                                                    The narrow form must be unique, unlike some other fields.
2139*912701f9SAndroid Build Coastguard Worker                                                    See also <a href="#Parsing_Dates_Times">Parsing Dates and Times</a>.</td></tr>
2140*912701f9SAndroid Build Coastguard Worker    <tr><td>aaaa</td><td>am. [e.g. 12 am.]</td><td>Wide</td></tr>
2141*912701f9SAndroid Build Coastguard Worker    <tr><td>aaaaa</td><td>a [e.g. 12a]</td><td>Narrow</td></tr>
2142*912701f9SAndroid Build Coastguard Worker    <!--  b  -->
2143*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="3">b</td><td>b..bbb</td><td>mid. [e.g. 12 mid.]</td><td>Abbreviated</td>
2144*912701f9SAndroid Build Coastguard Worker        <td rowspan="3"><strong>am, pm, noon, midnight</strong><br/>May be upper or lowercase depending on the locale and other options.
2145*912701f9SAndroid Build Coastguard Worker                        If the locale doesn't have the notion of a unique "noon" = 12:00, then the PM form may be substituted.
2146*912701f9SAndroid Build Coastguard Worker                        Similarly for "midnight" = 00:00 and the AM form.
2147*912701f9SAndroid Build Coastguard Worker                        The narrow form must be unique, unlike some other fields.</td></tr>
2148*912701f9SAndroid Build Coastguard Worker    <tr><td>bbbb</td><td>midnight<br/>[e.g. 12 midnight]</td><td>Wide</td></tr>
2149*912701f9SAndroid Build Coastguard Worker    <tr><td>bbbbb</td><td>md [e.g. 12 md]</td><td>Narrow</td></tr>
2150*912701f9SAndroid Build Coastguard Worker    <!--  B  -->
2151*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="3">B</td><td>B..BBB</td><td>at night<br/>[e.g. 3:00 at night]</td><td>Abbreviated</td>
2152*912701f9SAndroid Build Coastguard Worker        <td rowspan="3"><strong>flexible day periods</strong><br/>
2153*912701f9SAndroid Build Coastguard Worker                        May be upper or lowercase depending on the locale and other options.
2154*912701f9SAndroid Build Coastguard Worker                        Often there is only one width that is customarily used.</td></tr>
2155*912701f9SAndroid Build Coastguard Worker    <tr><td>BBBB</td><td>at night<br/>[e.g. 3:00 at night]</td><td>Wide</td></tr>
2156*912701f9SAndroid Build Coastguard Worker    <tr><td>BBBBB</td><td>at night<br/>[e.g. 3:00 at night]</td><td>Narrow</td></tr>
2157*912701f9SAndroid Build Coastguard Worker
2158*912701f9SAndroid Build Coastguard Worker<!-- == == == HOUR == == == -->
2159*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="22"><a name="dfst-hour" id="dfst-hour" href="#dfst-hour">hour</a></th><td rowspan="2">h</td><td>h</td><td>1, 12</td><td>Numeric: minimum digits</td>
2160*912701f9SAndroid Build Coastguard Worker        <td rowspan="2">Hour [1-12]. When used in skeleton data or in a skeleton passed in an API for flexible date pattern generation, it should match the 12-hour-cycle format preferred by the locale (h or K); it should not match a 24-hour-cycle format (H or k).</td></tr>
2161*912701f9SAndroid Build Coastguard Worker<tr><td>hh</td><td>01, 12</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2162*912701f9SAndroid Build Coastguard Worker    <!--  H  -->
2163*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="2">H</td><td>H</td><td>0, 23</td><td>Numeric: minimum digits</td>
2164*912701f9SAndroid Build Coastguard Worker        <td rowspan="2">Hour [0-23]. When used in skeleton data or in a skeleton passed in an API for flexible date pattern generation, it should match the 24-hour-cycle format preferred by the locale (H or k); it should not match a 12-hour-cycle format (h or K).</td></tr>
2165*912701f9SAndroid Build Coastguard Worker    <tr><td>HH</td><td>00, 23</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2166*912701f9SAndroid Build Coastguard Worker    <!--  K  -->
2167*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="2">K</td><td>K</td><td>0, 11</td><td>Numeric: minimum digits</td>
2168*912701f9SAndroid Build Coastguard Worker        <td rowspan="2">Hour [0-11]. When used in a skeleton, only matches K or h, see above.</td></tr>
2169*912701f9SAndroid Build Coastguard Worker    <tr><td>KK</td><td>00, 11</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2170*912701f9SAndroid Build Coastguard Worker    <!--  k  -->
2171*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="2">k</td><td>k</td><td>1, 24</td><td>Numeric: minimum digits</td>
2172*912701f9SAndroid Build Coastguard Worker        <td rowspan="2">Hour [1-24]. When used in a skeleton, only matches k or H, see above.</td></tr>
2173*912701f9SAndroid Build Coastguard Worker    <tr><td>kk</td><td>01, 24</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2174*912701f9SAndroid Build Coastguard Worker    <!--  j  -->
2175*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="6">j</td><td>j</td><td>8<br/>8 AM<br/>13<br/>1 PM</td><td>Numeric hour (minimum digits), abbreviated dayPeriod if used</td>
2176*912701f9SAndroid Build Coastguard Worker        <td rowspan="6"><em><strong>Input skeleton symbol</strong></em><br/>
2177*912701f9SAndroid Build Coastguard Worker                        It must not occur in pattern or skeleton data.
2178*912701f9SAndroid Build Coastguard Worker                        Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation.
2179*912701f9SAndroid Build Coastguard Worker                        In such a context, it requests the preferred hour format for the locale (h, H, K, or k), as determined by the <strong>preferred</strong> attribute of the <strong>hours</strong> element in supplemental data.
2180*912701f9SAndroid Build Coastguard Worker                        In the implementation of such an API, 'j' must be replaced by h, H, K, or k before beginning a match against availableFormats data.<br/>
2181*912701f9SAndroid Build Coastguard Worker                        Note that use of 'j' in a skeleton passed to an API is the only way to have a skeleton request a locale's preferred time cycle type (12-hour or 24-hour).</td></tr>
2182*912701f9SAndroid Build Coastguard Worker    <tr><td>jj</td><td>08<br/>08 AM<br/>13<br/>01 PM</td><td>Numeric hour (2 digits, zero pad if needed), abbreviated dayPeriod if used</td></tr>
2183*912701f9SAndroid Build Coastguard Worker    <tr><td>jjj</td><td>8<br/>8 A.M.<br/>13<br/>1 P.M.</td><td>Numeric hour (minimum digits), wide dayPeriod if used</td></tr>
2184*912701f9SAndroid Build Coastguard Worker    <tr><td>jjjj</td><td>08<br/>08 A.M.<br/>13<br/>01 P.M.</td><td>Numeric hour (2 digits, zero pad if needed), wide dayPeriod if used</td></tr>
2185*912701f9SAndroid Build Coastguard Worker    <tr><td>jjjjj</td><td>8<br/>8a<br/>13<br/>1p</td><td>Numeric hour (minimum digits), narrow dayPeriod if used</td></tr>
2186*912701f9SAndroid Build Coastguard Worker    <tr><td>jjjjjj</td><td>08<br/>08a<br/>13<br/>01p</td><td>Numeric hour (2 digits, zero pad if needed), narrow dayPeriod if used</td></tr>
2187*912701f9SAndroid Build Coastguard Worker    <!--  J  -->
2188*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="2">J</td><td>J</td><td>8<br/>8</td><td>Numeric hour (minimum digits)</td>
2189*912701f9SAndroid Build Coastguard Worker        <td rowspan="2"><em><strong>Input skeleton symbol</strong></em><br/>It must not occur in pattern or skeleton data.
2190*912701f9SAndroid Build Coastguard Worker                        Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation.
2191*912701f9SAndroid Build Coastguard Worker                        In such a context, like 'j', it requests the preferred hour format for the locale (h, H, K, or k), as determined by the <strong>preferred</strong> attribute of the <strong>hours</strong> element in supplemental data.
2192*912701f9SAndroid Build Coastguard Worker                        However, unlike 'j', it requests no dayPeriod marker such as “am/pm” (it is typically used where there is enough context that that is not necessary).
2193*912701f9SAndroid Build Coastguard Worker                        For example, with "jmm", 18:00 could appear as “6:00 PM”, while with "Jmm", it would appear as “6:00” (no PM).</td></tr>
2194*912701f9SAndroid Build Coastguard Worker    <tr><td>JJ</td><td>08<br/>08</td><td>Numeric hour (2 digits, zero pad if needed)</td></tr>
2195*912701f9SAndroid Build Coastguard Worker    <!--  C  -->
2196*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="6">C</td><td>C</td><td>8<br/>8 (morning)</td><td>Numeric hour (minimum digits), abbreviated dayPeriod if used</td>
2197*912701f9SAndroid Build Coastguard Worker        <td rowspan="6"><em><strong>Input skeleton symbol</strong></em><br/>It must not occur in pattern or skeleton data.
2198*912701f9SAndroid Build Coastguard Worker                        Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation.
2199*912701f9SAndroid Build Coastguard Worker                        In such a context, like 'j', it requests the preferred hour format for the locale.
2200*912701f9SAndroid Build Coastguard Worker                        However, unlike 'j', it can also select formats such as hb or hB, since it is based not on the <strong>preferred</strong> attribute of the <strong>hours</strong> element in supplemental data, but instead on the first element of the <strong>allowed</strong> attribute (which is an ordered preferrence list).
2201*912701f9SAndroid Build Coastguard Worker                        For example, with "Cmm", 18:00 could appear as “6:00 in the afternoon”.</td></tr>
2202*912701f9SAndroid Build Coastguard Worker    <tr><td>CC</td><td>08<br/>08 (morning)</td><td>Numeric hour (2 digits, zero pad if needed), abbreviated dayPeriod if used</td></tr>
2203*912701f9SAndroid Build Coastguard Worker    <tr><td>CCC</td><td>8<br/>8 in the morning</td><td>Numeric hour (minimum digits), wide dayPeriod if used</td></tr>
2204*912701f9SAndroid Build Coastguard Worker    <tr><td>CCCC</td><td>08<br/>08 in the morning</td><td>Numeric hour (2 digits, zero pad if needed), wide dayPeriod if used</td></tr>
2205*912701f9SAndroid Build Coastguard Worker    <tr><td>CCCCC</td><td>8<br/>8 (morn.)</td><td>Numeric hour (minimum digits), narrow dayPeriod if used</td></tr>
2206*912701f9SAndroid Build Coastguard Worker    <tr><td>CCCCCC</td><td>08<br/>08 (morn.)</td><td>Numeric hour (2 digits, zero pad if needed), narrow dayPeriod if used</td></tr>
2207*912701f9SAndroid Build Coastguard Worker
2208*912701f9SAndroid Build Coastguard Worker<!-- == == == MINUTE == == == -->
2209*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="2"><a name="dfst-minute" id="dfst-minute" href="#dfst-minute">minute</a></th><td rowspan="2">m</td><td>m</td><td>8, 59</td><td>Numeric: minimum digits</td>
2210*912701f9SAndroid Build Coastguard Worker        <td rowspan="2">Minute (numeric). Truncated, not rounded.<br/></td></tr>
2211*912701f9SAndroid Build Coastguard Worker    <tr><td>mm</td><td>08, 59</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2212*912701f9SAndroid Build Coastguard Worker
2213*912701f9SAndroid Build Coastguard Worker<!-- == == == SECOND == == == -->
2214*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="4"><a name="dfst-second" id="dfst-second" href="#dfst-second">second</a></th><td rowspan="2">s</td><td>s</td><td>8, 12</td><td>Numeric: minimum digits</td>
2215*912701f9SAndroid Build Coastguard Worker        <td rowspan="2">Second (numeric). Truncated, not rounded.<br/></td></tr>
2216*912701f9SAndroid Build Coastguard Worker    <tr><td>ss</td><td>08, 12</td><td>Numeric: 2 digits, zero pad if needed</td></tr>
2217*912701f9SAndroid Build Coastguard Worker    <tr><td>S</td><td>S+</td><td>3456</td>
2218*912701f9SAndroid Build Coastguard Worker        <td colspan="2">Fractional Second (numeric).
2219*912701f9SAndroid Build Coastguard Worker                        Truncates, like other numeric time fields, but in this case to the number of digits specified by the field length.
2220*912701f9SAndroid Build Coastguard Worker                        (Example shows display using pattern SSSS for seconds value 12.34567)</td></tr>
2221*912701f9SAndroid Build Coastguard Worker    <tr><td>A</td><td>A+</td><td>69540000</td>
2222*912701f9SAndroid Build Coastguard Worker        <td colspan="2">Milliseconds in day (numeric).
2223*912701f9SAndroid Build Coastguard Worker                        This field behaves <i>exactly</i> like a composite of all time-related fields, not including the zone fields.
2224*912701f9SAndroid Build Coastguard Worker                        As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward.
2225*912701f9SAndroid Build Coastguard Worker                        On a day of DST cessation, it will jump backward.
2226*912701f9SAndroid Build Coastguard Worker                        This reflects the fact that it must be combined with the offset field to obtain a unique local time value.
2227*912701f9SAndroid Build Coastguard Worker                        The field length specifies the minimum number of digits, with zero-padding as necessary.</td></tr>
2228*912701f9SAndroid Build Coastguard Worker
2229*912701f9SAndroid Build Coastguard Worker<!-- == == == SEPARATOR == == == -->
2230*912701f9SAndroid Build Coastguard Worker<tr><th><a name="dfst-sep" id="dfst-sep" href="#dfst-sep">sep.</a></th><td>(none def., see note)</td><td></td><td></td>
2231*912701f9SAndroid Build Coastguard Worker        <td colspan="2">Time separator.<br/><br/><span class="note"><b>Note:</b>
2232*912701f9SAndroid Build Coastguard Worker                        In CLDR 26 the time separator pattern character was specified to be COLON.
2233*912701f9SAndroid Build Coastguard Worker                        This was withdrawn in CLDR 28 due to backward compatibility issues, and no time separator pattern character is currently defined.</span><br/><br/>
2234*912701f9SAndroid Build Coastguard Worker                        Like the use of "," in number formats, this character in a date pattern is replaced with the corresponding number symbol which may depend on the numbering system.
2235*912701f9SAndroid Build Coastguard Worker                        For more information, see <em><strong>Part 3: <a href="tr35-numbers.md#Contents">Numbers</a></strong>, <a href="tr35-numbers.md#Number_Symbols">Number Symbols</a></em>.</td></tr>
2236*912701f9SAndroid Build Coastguard Worker
2237*912701f9SAndroid Build Coastguard Worker<!-- == == == ZONE == == == -->
2238*912701f9SAndroid Build Coastguard Worker<tr><th rowspan="23"><a name="dfst-zone" id="dfst-zone" href="#dfst-zone">zone</a></th><td rowspan="2">z</td><td>z..zzz</td><td>PDT</td>
2239*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>short specific non-location format</i>. Where that is unavailable, falls back to the <i>short localized GMT format</i> ("O").</td></tr>
2240*912701f9SAndroid Build Coastguard Worker    <tr><td>zzzz</td><td>Pacific Daylight Time</td>
2241*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>long specific non-location format</i>.
2242*912701f9SAndroid Build Coastguard Worker                        Where that is unavailable, falls back to the <i>long localized GMT format</i> ("OOOO").</td></tr>
2243*912701f9SAndroid Build Coastguard Worker    <!--  Z  -->
2244*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="3">Z</td><td>Z..ZZZ</td><td>-0800</td>
2245*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields.
2246*912701f9SAndroid Build Coastguard Worker                        The format is equivalent to RFC 822 zone format (when optional seconds field is absent).
2247*912701f9SAndroid Build Coastguard Worker                        This is equivalent to the "xxxx" specifier.</td></tr>
2248*912701f9SAndroid Build Coastguard Worker    <tr><td>ZZZZ</td><td>GMT-8:00</td>
2249*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>long localized GMT format</i>.
2250*912701f9SAndroid Build Coastguard Worker                        This is equivalent to the "OOOO" specifier.</td></tr>
2251*912701f9SAndroid Build Coastguard Worker    <tr><td>ZZZZZ</td><td>-08:00<br/>-07:52:58</td>
2252*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields.
2253*912701f9SAndroid Build Coastguard Worker                        The ISO8601 UTC indicator "Z" is used when local time offset is 0.
2254*912701f9SAndroid Build Coastguard Worker                        This is equivalent to the "XXXXX" specifier.</td></tr>
2255*912701f9SAndroid Build Coastguard Worker    <!--  O  -->
2256*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="2">O</td><td>O</td><td>GMT-8</td><td colspan="2">The <i>short localized GMT format</i>.</td></tr>
2257*912701f9SAndroid Build Coastguard Worker    <tr><td>OOOO</td><td>GMT-08:00</td><td colspan="2">The <i>long localized GMT format</i>.</td></tr>
2258*912701f9SAndroid Build Coastguard Worker    <!--  v  -->
2259*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="2">v</td><td>v</td><td>PT</td>
2260*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>short generic non-location format</i>
2261*912701f9SAndroid Build Coastguard Worker                        Where that is unavailable, falls back to the <i>generic location format</i> ("VVVV"), then the <i>short localized GMT format</i> as the final fallback.</td></tr>
2262*912701f9SAndroid Build Coastguard Worker    <tr><td>vvvv</td><td>Pacific Time</td>
2263*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>long generic non-location format</i>.
2264*912701f9SAndroid Build Coastguard Worker                        Where that is unavailable, falls back to <i>generic location format</i> ("VVVV").</td></tr>
2265*912701f9SAndroid Build Coastguard Worker    <!--  V  -->
2266*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="4">V</td><td>V</td><td>uslax</td>
2267*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The short time zone ID. Where that is unavailable, the special short time zone ID <i>unk</i> (Unknown Zone) is used.<br/>
2268*912701f9SAndroid Build Coastguard Worker                        <i><b>Note</b>: This specifier was originally used for a variant of the short specific non-location format, but it was deprecated in the later version of this specification.
2269*912701f9SAndroid Build Coastguard Worker                        In CLDR 23, the definition of the specifier was changed to designate a short time zone ID.</i></td></tr>
2270*912701f9SAndroid Build Coastguard Worker    <tr><td>VV</td><td>America/Los_Angeles</td><td colspan="2">The long time zone ID.</td></tr>
2271*912701f9SAndroid Build Coastguard Worker    <tr><td>VVV</td><td>Los Angeles</td>
2272*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The exemplar city (location) for the time zone.
2273*912701f9SAndroid Build Coastguard Worker                        Where that is unavailable, the localized exemplar city name for the special zone <i>Etc/Unknown</i> is used as the fallback (for example, "Unknown City").</td></tr>
2274*912701f9SAndroid Build Coastguard Worker    <tr><td>VVVV</td><td>Los Angeles Time</td>
2275*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>generic location format</i>.
2276*912701f9SAndroid Build Coastguard Worker                        Where that is unavailable, falls back to the <i>long localized GMT format</i> ("OOOO"; Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.)<br/>
2277*912701f9SAndroid Build Coastguard Worker                        This is especially useful when presenting possible timezone choices for user selection, since the naming is more uniform than the "v" format.</td></tr>
2278*912701f9SAndroid Build Coastguard Worker    <!--  X  -->
2279*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="5">X</td><td>X</td><td>-08<br/>+0530<br/>Z</td>
2280*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 basic format</i> with hours field and optional minutes field.
2281*912701f9SAndroid Build Coastguard Worker                        The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as x, plus "Z".)</td></tr>
2282*912701f9SAndroid Build Coastguard Worker    <tr><td>XX</td><td>-0800<br/>Z</td>
2283*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 basic format</i> with hours and minutes fields.
2284*912701f9SAndroid Build Coastguard Worker                        The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xx, plus "Z".)</td></tr>
2285*912701f9SAndroid Build Coastguard Worker    <tr><td>XXX</td><td>-08:00<br/>Z</td>
2286*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 extended format</i> with hours and minutes fields.
2287*912701f9SAndroid Build Coastguard Worker                        The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxx, plus "Z".)</td></tr>
2288*912701f9SAndroid Build Coastguard Worker    <tr><td>XXXX</td><td>-0800<br/>-075258<br/>Z</td>
2289*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields.
2290*912701f9SAndroid Build Coastguard Worker                        The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxxx, plus "Z".)<br/>
2291*912701f9SAndroid Build Coastguard Worker                        <i><b>Note</b>: The seconds field is not supported by the ISO8601 specification.</i></td></tr>
2292*912701f9SAndroid Build Coastguard Worker    <tr><td>XXXXX</td><td>-08:00<br/>-07:52:58<br/>Z</td>
2293*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields.
2294*912701f9SAndroid Build Coastguard Worker                        The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxxxx, plus "Z".)<br/>
2295*912701f9SAndroid Build Coastguard Worker                        <i><b>Note</b>: The seconds field is not supported by the ISO8601 specification.</i></td></tr>
2296*912701f9SAndroid Build Coastguard Worker    <!--  x  -->
2297*912701f9SAndroid Build Coastguard Worker    <tr><td rowspan="5">x</td><td>x</td><td>-08<br/>+0530<br/>+00</td>
2298*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 basic format</i> with hours field and optional minutes field. (The same as X, minus "Z".)</td></tr>
2299*912701f9SAndroid Build Coastguard Worker    <tr><td>xx</td><td>-0800<br/>+0000</td>
2300*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 basic format</i> with hours and minutes fields. (The same as XX, minus "Z".)</td></tr>
2301*912701f9SAndroid Build Coastguard Worker    <tr><td>xxx</td><td>-08:00<br/>+00:00</td>
2302*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 extended format</i> with hours and minutes fields. (The same as XXX, minus "Z".)</td></tr>
2303*912701f9SAndroid Build Coastguard Worker    <tr><td>xxxx</td><td>-0800<br/>-075258<br/>+0000</td>
2304*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 basic format</i> with hours, minutes and optional seconds fields. (The same as XXXX, minus "Z".)<br/>
2305*912701f9SAndroid Build Coastguard Worker                        <i><b>Note</b>: The seconds field is not supported by the ISO8601 specification.</i></td></tr>
2306*912701f9SAndroid Build Coastguard Worker    <tr><td>xxxxx</td><td>-08:00<br/>-07:52:58<br/>+00:00</td>
2307*912701f9SAndroid Build Coastguard Worker        <td colspan="2">The <i>ISO8601 extended format</i> with hours, minutes and optional seconds fields. (The same as XXXXX, minus "Z".)<br/>
2308*912701f9SAndroid Build Coastguard Worker                        <i><b>Note</b>: The seconds field is not supported by the ISO8601 specification.</i></td></tr>
2309*912701f9SAndroid Build Coastguard Worker</tbody></table>
2310*912701f9SAndroid Build Coastguard Worker
2311*912701f9SAndroid Build Coastguard Worker### <a name="Localized_Pattern_Characters" href="#Localized_Pattern_Characters">Localized Pattern Characters (deprecated)</a>
2312*912701f9SAndroid Build Coastguard Worker
2313*912701f9SAndroid Build Coastguard WorkerThese are characters that can be used when displaying a date pattern to an end user. This can occur, for example, when a spreadsheet allows users to specify date patterns. Whatever is in the string is substituted one-for-one with the characters "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxr", with the above meanings. Thus, for example, if 'J' is to be used instead of 'Y' to mean Year (for Week of Year), then the string would be: "GyMdkHmsSEDFwWahKzJeugAZvcLQqVUOXxr".
2314*912701f9SAndroid Build Coastguard Worker
2315*912701f9SAndroid Build Coastguard WorkerThis element is deprecated. It is recommended instead that a more sophisticated UI be used for localization, such as using icons to represent the different formats (and lengths) in the [Date Field Symbol Table](#Date_Field_Symbol_Table).
2316*912701f9SAndroid Build Coastguard Worker
2317*912701f9SAndroid Build Coastguard Worker### <a name="Date_Patterns_AM_PM" href="#Date_Patterns_AM_PM">AM / PM</a>
2318*912701f9SAndroid Build Coastguard Worker
2319*912701f9SAndroid Build Coastguard WorkerEven for countries where the customary date format only has a 24 hour format, both the am and pm localized strings must be present and must be distinct from one another. Note that as long as the 24 hour format is used, these strings will normally never be used, but for testing and unusual circumstances they must be present.
2320*912701f9SAndroid Build Coastguard Worker
2321*912701f9SAndroid Build Coastguard Worker### <a name="Date_Patterns_Eras" href="#Date_Patterns_Eras">Eras</a>
2322*912701f9SAndroid Build Coastguard Worker
2323*912701f9SAndroid Build Coastguard WorkerThere are only two values for era in the Gregorian calendar, with two common naming conventions (here in abbreviated form for English): "BC" and "AD", or "BCE" and "CE". These values can be translated into other languages, like "a.C." and "d.C." for Spanish, but there are no other eras in the Gregorian calendar. Other calendars have different numbers of eras. Care should be taken when translating the era names for a specific calendar.
2324*912701f9SAndroid Build Coastguard Worker
2325*912701f9SAndroid Build Coastguard Worker### <a name="Date_Patterns_Week_Of_Year" href="#Date_Patterns_Week_Of_Year">Week of Year</a>
2326*912701f9SAndroid Build Coastguard Worker
2327*912701f9SAndroid Build Coastguard WorkerValues calculated for the Week of Year field range from 1 to 53 for the Gregorian calendar (they may have different ranges for other calendars). Week 1 for a year is the first week that contains at least the specified minimum number of days from that year. Weeks between week 1 of one year and week 1 of the following year are numbered sequentially from 2 to 52 or 53 (if needed). For example, January 1, 1998 was a Thursday. If the first day of the week is MONDAY and the minimum days in a week is 4 (these are the values reflecting ISO 8601 and many national standards), then week 1 of 1998 starts on December 29, 1997, and ends on January 4, 1998. However, if the first day of the week is SUNDAY, then week 1 of 1998 starts on January 4, 1998, and ends on January 10, 1998. The first three days of 1998 are then part of week 53 of 1997.
2328*912701f9SAndroid Build Coastguard Worker
2329*912701f9SAndroid Build Coastguard WorkerValues are similarly calculated for the Week of Month.
2330*912701f9SAndroid Build Coastguard Worker
2331*912701f9SAndroid Build Coastguard Worker### <a name="Date_Patterns_Week_Elements" href="#Date_Patterns_Week_Elements">Week Elements</a>
2332*912701f9SAndroid Build Coastguard Worker
2333*912701f9SAndroid Build Coastguard Worker**firstDay**
2334*912701f9SAndroid Build Coastguard Worker
2335*912701f9SAndroid Build Coastguard WorkerA number indicating which day of the week is considered the 'first' day, for calendar purposes. Because the ordering of days may vary between calendar, keywords are used for this value, such as sun, mon, …. These values will be replaced by the localized name when they are actually used.
2336*912701f9SAndroid Build Coastguard Worker
2337*912701f9SAndroid Build Coastguard Worker**minDays (Minimal Days in First Week)**
2338*912701f9SAndroid Build Coastguard Worker
2339*912701f9SAndroid Build Coastguard WorkerMinimal days required in the first week of a month or year. For example, if the first week is defined as one that contains at least one day, this value will be 1. If it must contain a full seven days before it counts as the first week, then the value would be 7.
2340*912701f9SAndroid Build Coastguard Worker
2341*912701f9SAndroid Build Coastguard Worker**weekendStart, weekendEnd**
2342*912701f9SAndroid Build Coastguard Worker
2343*912701f9SAndroid Build Coastguard WorkerIndicates the day and time that the weekend starts or ends. As with firstDay, keywords are used instead of numbers.
2344*912701f9SAndroid Build Coastguard Worker
2345*912701f9SAndroid Build Coastguard Worker## <a name="Parsing_Dates_Times" href="#Parsing_Dates_Times">Parsing Dates and Times</a>
2346*912701f9SAndroid Build Coastguard Worker
2347*912701f9SAndroid Build Coastguard WorkerFor general information on lenient parsing, see [Lenient Parsing](tr35.md#Lenient_Parsing) in the core specification. This section provides additional information specific to parsing of dates and times.
2348*912701f9SAndroid Build Coastguard Worker
2349*912701f9SAndroid Build Coastguard WorkerLenient parsing of date and time strings is especially complicated, due to the large number of possible fields and formats. The fields fall into two categories: numeric fields (hour, day of month, year, numeric month, and so on) and symbolic fields (era, quarter, month, weekday, AM/PM, time zone). In addition, the user may type in a date or time in a form that is significantly different from the normal format for the locale, and the application must use the locale information to figure out what the user meant. Input may well consist of nothing but a string of numbers with separators, for example, "09/05/02 09:57:33".
2350*912701f9SAndroid Build Coastguard Worker
2351*912701f9SAndroid Build Coastguard WorkerThe input can be separated into tokens: numbers, symbols, and literal strings. Some care must be taken due to ambiguity, for example, in the Japanese locale the symbol for March is "3 月", which looks like a number followed by a literal. To avoid these problems, symbols should be checked first, and spaces should be ignored (except to delimit the tokens of the input string).
2352*912701f9SAndroid Build Coastguard Worker
2353*912701f9SAndroid Build Coastguard WorkerThe meaning of symbol fields should be easy to determine; the problem is determining the meaning of the numeric fields. Disambiguation will likely be most successful if it is based on heuristics. Here are some rules that can help:
2354*912701f9SAndroid Build Coastguard Worker
2355*912701f9SAndroid Build Coastguard Worker* Always try the format string expected for the input text first. This is the only way to disambiguate 03/07 (March 2007, a credit card expiration date) from 03/07 (March 7, a birthday).
2356*912701f9SAndroid Build Coastguard Worker* Attempt to match fields and literals against those in the format string, using loose matching of the tokens. In particular, Unicode normalization and case variants should be accepted. Alternate symbols can also be accepted where unambiguous: for example, “11.30 am”.
2357*912701f9SAndroid Build Coastguard Worker* When matching symbols, try the narrow, abbreviated, and full-width forms, including standalone forms if they are unique. You may want to allow prefix matches too, or diacritic-insensitive, again, as long as they are unique. For example, for a month, accept 9, 09, S, Se, Sep, Sept, Sept., and so on. For abbreviated symbols (e.g. names of eras, months, weekdays), allow matches both with and without an abbreviation marker such as period (or whatever else may be customary in the locale); abbreviated forms in the CLDR data may or may not have such a marker.
2358*912701f9SAndroid Build Coastguard Worker  * Note: While parsing of narrow date values (e.g. month or day names) may be required in order to obtain minimum information from a formatted date (for instance, the only month information may be in a narrow form), the results are not guaranteed; parsing of an ambiguous formatted date string may produce a result that differs from the date originally used to create the formatted string.
2359*912701f9SAndroid Build Coastguard Worker  * For day periods, ASCII variants for AM/PM such as “am”, “a.m.”, “am.” (and their case variants) should be accepted, since they are widely used as alternates to native formats.
2360*912701f9SAndroid Build Coastguard Worker* When a field or literal is encountered that is not compatible with the pattern:
2361*912701f9SAndroid Build Coastguard Worker  * Synchronization is not necessary for symbolic fields, since they are self-identifying. Wait until a numeric field or literal is encountered before attempting to resynchronize.
2362*912701f9SAndroid Build Coastguard Worker  * Ignore whether the input token is symbolic or numeric, if it is compatible with the current field in the pattern.
2363*912701f9SAndroid Build Coastguard Worker  * Look forward or backward in the current format string for a literal that matches the one most recently encountered. See if you can resynchronize from that point. Use the value of the numeric field to resynchronize as well, if possible (for example, a number larger than the largest month cannot be a month).
2364*912701f9SAndroid Build Coastguard Worker  * If that fails, use other format strings from the locale (including those in `<availableFormats>`) to try to match the previous or next symbol or literal (again, using a loose match).
2365*912701f9SAndroid Build Coastguard Worker
2366*912701f9SAndroid Build Coastguard Worker* * *
2367*912701f9SAndroid Build Coastguard Worker
2368*912701f9SAndroid Build Coastguard WorkerCopyright © 2001–2024 Unicode, Inc. All Rights Reserved. The Unicode Consortium makes no expressed or implied warranty of any kind, and assumes no liability for errors or omissions. No liability is assumed for incidental and consequential damages in connection with or arising out of the use of the information or programs contained or accompanying this technical report. The Unicode [Terms of Use](https://www.unicode.org/copyright.html) apply.
2369*912701f9SAndroid Build Coastguard Worker
2370*912701f9SAndroid Build Coastguard WorkerUnicode and the Unicode logo are trademarks of Unicode, Inc., and are registered in some jurisdictions.
2371