Date/Time Patterns

Last updated: 2018-May-14

Patterns Introduction

Pre-requisite topics to read:

A date-time pattern is a string of characters in which fields representing date and time symbols are combined together with necessary “literal” strings that are used as is.

There are two types of substrings that are combined in a pattern:

  1. Date/time fields, which are placeholders that represent particular calendar values such as month, weekday, year, etc..
  2. “Literal” strings used as-is. These are necessary to make the pattern flow naturally in a given language.
  3. For example:
Skeleton format English Pattern English Example Japanese Pattern Japanese Example
yMMMd MMM e, y Dec 5, 2010 y年M月d 日 2010年12月5日

There are three aspects to patterns: 

To demonstrate how this work with examples, see the spec Date Format Pattern Examples.

💡 Translation Tips

Synchronizing Date/Time Names and Patterns

There is a tight coupling between the date/time patterns and the names that are used for date/time elements, described in Date/Time Names. Therefore, when supplying the data, it requires coordination between what you supply as the names and your intention on which name to use in patterns.

When to use Standalone vs. Formatting

Some types of names have two styles and these are differentiated in the survey tool section headings a Formatting and Standalone.

Using the month names as examples:

Following are examples of differences and implications based on language:

  wide format months (Use pattern: MMMM) wide stand-alone months Use pattern: LLLL) pattern for full date, e.g.in e-mail log: “d. MMMM y”; thus, intended to use the format style names as examples below. pattern for month + year, e.g. in calendar: “LLLL y”; thus intended to use the stand-alone names as examples below: pattern for month name by itself, e.g. in menu: “LLLL” ; thus, intended to use the stand-alone names as examples below:
7 heinäkuuta heinäkuu 5. heinäkuuta 2018 heinäkuu 2018 heinäkuu
8 elokuuta elokuu 10. elokuuta 2018 elokuu 2018 elokuu
9 syyskuuta syyskuu 15. syyskuuta 2018 syyskuu 2018 syyskuu
10 lokakuuta lokakuu 20. lokakuuta 2018 lokakuu 2018 lokakuu
  wide format months Use pattern (MMMM) wide stand-alone months Use pattern (LLLL) pattern for full date, e.g.in e-mail log: “d MMMM ‘de’ y”; thus, intended to use the format style names as examples below: pattern for month + year, e.g. in calendar: “ LLLL ‘de’ y”; thus intended to use the stand-alone names as examples below: pattern for month name by itself, e.g. in menu: “ LLLL ”; thus, intended to use the stand-alone names as examples below:
7 de juliol juliol 5 de juliol de 2018 juliol de 2018 juliol
8 d’agost agost 10 d’agost de 2018 agost de 2018 agost
9 de setembre setembre 15 de setembre de 2018 setembre de 2018 setembre
10 d’octubre octubre 20 d’octubre de 2018 octubre de 2018 octubre
Format String Date Result
LLLL 2008-1-14 gener
  2008-4-14 abril
d MMMM ‘de’ y 2008-1-14 14 de gener de 2008
  2008-4-14 14 d’abril de 2008

💡 Translation Tips

Basic Time Formats

The standard formats include four basic time formats. See Survey Tool Formats-Standard-Time formats

Using 24 hour vs 12 hour symbols: The symbols you use in time format patterns depend on whether the main country/region of the language uses 12-hour time or 24 hour format.

If a non-default country/region use a different time format than the default country/region for the language, then this difference should be added for the sub-locale. Also see Regional variants

For example, if es (= es_ES, Spanish as used in Spain) uses 24-hour time formats, but es_US (Spanish as used in United States) uses 12 hour time formats, then es would use “HH:mm/H:mm” and es_US would use the “h” formats as described above. .

💡 Translation Tips

Basic Date Formats

The standard Date formats include four basic formats. See Survey Tool Formats-Standard-Date formats. (Note that the Month symbol especially may vary (M vs MM, or MMM vs LLL). For more information, see Date/Time Symbols.)

Form Include English pattern examples
Full long-weekday (EEEE), year (y), long-month (MMMM), day In some non-Gregorian calendars, it will also contain G representing the era name, such as “AH” or “Heisei” (i.e. “平成”). For some languages, long months are not used; for example, in Japanese the numeric month is used in patterns, in front of the character 月. EEEE, MMMM d, y (e.g. “Tuesday, September 14, 1999”)
Long year (y), long-month (MMMM), day (d). MMMM d, y (e.g. “September 14, 1999”.)
Medium year (y), abbreviated-month (MMM), day (d). For languages that do not use abbreviated months , use the numeric month (MM/M). For example, “y/MM/dd” , corresponding to a date like “1999/09/14”. MMM d, y (e.g. “Sep 14, 1999”.)
Short year, numeric-month (MM/M), and day. M/d/yy (e.g. “9/14/99”)

Additional Date-Time Formats

The basic formats as described in above sections provide a small subset of the combinations. To expand to fully cover all variations of date and time formats, a skeleton format is provided that uses the Date/Time Symbols (without order or punctuation) to indicate what fields are desired. 

An example usage of the flexible formats would be: a software program only needs the year and month information, the flexible pattern yMMM would be used to provide the desired year and month formatting as shown in the English and Japanese examples in this table. 

Skeleton English Pattern English Example Japanese Pattern Japanese Example
yMMM MMM y Dec 2010 y年M月 2010年12月
Skeleton Hypothetical English case   For ja@calendar=chinese    
  Pattern Example      
supplied MMMEd E MMM d Tue Apr 18 MMMd日(E) 四月18日(火)
inferred 1 MMMMEd E MMMM d Tue April 18 MMMMd日(E) 四月18日(火)
inferred 2 MMMEEEEd EEEE MMM d Tuesday Apr 18 [incorrect] MMMd日(EEEE) 四月18日(火 曜日) [incorrect]
inferred 3 MMMMEEEEd EEEE MMMM d Tuesday April 18 [incorrect] MMMMd日(EEEE) 四月18日(火曜日) [incorrect]

Standalone vs. Formatting in Flexible formats

In languages that distinguish between nominative and genitive (or related form such as partitive), the use of symbols in flexible formats also specify the use of nominative forms or genitive (or related) forms of month and day names. 

To understand which pattern characters are used for standalone forms (nominative) versus format forms (genitive or related, such as partitive), see Stand-Alone vs Format Styles, see also the discussion above in Synchronizing Date/Time Names and Patterns.

Supplied vs. Inferred patterns

Some patterns supplied for each skeleton may be extended from the abbreviated form to an inferred full form by developers who use CLDR. 

Some Inferred patterns usage are incorrect, instead use the most closely associated skeletons that are available. Build on a chain of fallback options based on available patterns is a good practice. 

Example expansions:

           
supplied MMMEEEEd EEEE, MMM d Tuesday, Apr 18 [correct] MMMd日EEEE 四月18日火曜日 [correct]
inferred 4 MMMMEEEEd EEEE, MMMM d Tuesday, April 18 [correct] MMMMd日EEEE 四月18日火曜日 [correct]

The correctness of inferred from abbreviated the full will differ by locale. 

In the examples above table, Inferred 2 and Inferred 3 examples are incorrect, because:

Some languages do not use abbreviated months; therefore, a skeleton containing abbreviated month MMM is mapped to a pattern that uses numeric month M or MM. For example, skeleton yMMMd may be supplied with the numeric month d.M.y.

Skeleton Pattern Example  
supplied yMMMd d.M.y 18.4.2015
supplied yMMMMd d. MMMM y 18. huhtikuuta 2015
without the second entry, would have: inferred yMMMMd d.M.y 18.4.2015

💡 Translation Tips

Day period patterns

There are three pattern characters that can you can use to indicate the day period marker in 12-hour-cycle time formats:

Symbol Meaning English example
a (abbreviated) aaaa (full) aaaaa (narrow) AM and PM 12:00 AM, 10:00 AM, 12:00 PM, 7:00 PM
b (abbreviated) bbbb (full) bbbbb (narrow) AM, PM, noon and midnight, 10:00 AM, 12:00 noon, 7:00 PM
B (abbreviated) BBBB (full) BBBBB (narrow) day periods with locale-specific ranges. If a locale does not have data for such day period ranges, this is equivalent to ‘b’. 2:00 at night, 10:00 in the morning, 12:00 in the afternoon, 7:00 in the evening.

With skeletons (listed in the Code column in Survey Tool) that specify ‘h’ but no day period, the corresponding patterns are specified with a day period, normally ‘a’ or ‘b’. The patterns can be used to infer how to handle a request for a different day period. For example:

Code English pattern (example)  
supplied hm h:mm a
inferred ahm h:mm a
inferred aaaahm h:mm aaaa
inferred bhm h:mm b
inferred bbbbhm h:mm bbbb
inferred* Bhm h:mm B [*see notes below]
inferred* BBBBhm h:mm BBBB [*see notes below]

Beginning in CLDR 32, there are 5 additional time patterns that indicate how times should be formatted using day period ranges ‘B’. This allows locales to have formats for day period ranges that can display the range symbol in a different position than might be used for symbols for AM, PM, noon, or midnight:

Code English pattern (example)  
supplied Bh B h
supplied Bhm B h:mm
supplied Bhms B h:mm:ss
supplied EBhm B h:mm, E
supplied EBhms B h:mm:ss, E
inferred BBBBhm BBBB h:mm
inferred

These new patterns are available in Gregorian and Generic calendars, In these new fields, provide locale data by:

💡 Translation Tips

  1. Examples in the Survey Tool show some day periods for the locale as shown in this screenshot below. If the examples for day period ranges show them in the wrong position, then the time formats specific to using day period ranges may be updated.
    1. Placing the pattern character (‘B’ in the example below) in the correct position.
    2. If it is equally good in two different positions, favor the position used for the ‘a’ pattern character.
    3. If the position needs to be different depending on the width of B, please file a ticket.
  2. For more information on the day periods used in your language:
    1. First see Day Periods (AM, PM, etc.) for a general discussion of how day periods work.
    2. See the Day Periods chart for your language.

image

Date-Time Combined Formats

The date-time pattern shows how to combine separate patterns for date (represented by {1}) and time (represented by {0}) into a single pattern. It usually doesn’t need to be changed. 

What you want to pay attention to are:

💡 Translation Tips

There are four formats: full, long, medium, and short. Each of these may come in two variants:

Before CLDR 42, there was only one variant for these. In English that variant used the “-atTime” style, as did many other locales. For CLDR 42, that  “-⁠atTime” data has been moved to the “-⁠atTime” variants, and the standard data has initially been extrapolated from the mediu or short formats without literal text. However, it needs to be checked.

The determination of which to use by developers using CLDR data is normally based on the date style, for example:

Following are examples on how the data can be different by locale with different combinations of format length. (note: {1}=date format with {0}= time format)

 

Another way to look at the example with original patterns and combined result:

Pattern English German Japanese
Full {1} ‘at’ {0}

{Full form of the date format} at {full form of the time format}
{1} ‘at’ {0}

Sunday, September 5, 1999 at 1:25:59 PM Eastern Standard Time
{1} ‘um’ {0}

Sonntag, 5. September 1999 um 13:25:59 Nordamerikanische Ostküsten-Normalzeit
{1} {0}

1999年9月5日日曜日 13時25分59秒 アメリカ東部標準時
Medium {1}, {0}

{medium form of the date format}, {medium form of the time format}

Notice the comma and space between the date portion and the time portion.
{1}, {0}

Sep 5, 1999, 1:25:59 PM
{1}, {0} Result: 05.09.1999, 13:25:59 {1} {0}

1999/09/05 13:25:59
       
date pattern time pattern date-time combining pattern used formatted example
MMMM d, y h:mm a [long] {1} ‘at’ {0} September 14, 1999 at 1:25 PM
M/d/yy h:mm a [short] {1}, {0} 9/14/99, 1:25 PM
     
Survey Tool field English pattern Pattern characters
yw-one ‘week’ w ‘of’ Y (example: Week 37 of 2009) w designates the number of the week within a year calculated for week-of year purposes and indicated using the pattern character Y (instead of the normal year designator y). The year indicated by Y typically begins on the locale’s first day of the week and ends on the last day of the week, so its transitions may differ by a few days from the standard year indicated by y.
yw-other ‘week’ w ‘of’ Y  
MMMMW-one ‘week’ W ‘of’ MMMM (example: Week 3 of April) W designates the number of the week within the month
MMMMW-other ‘week’ W ‘of’ MMMM  

Week-Of Patterns

The week-of date patterns were introduced in CLDR 30 for enumerating week count in larger periods, e.g. “week 15 of 2016” or “week 4 of April”. The Survey Tool fields and corresponding English entries are shown below:

For developers who use CLDR data, 

💡 Translation Tips

As described under Date/Time Names, CLDR also provides a relative week period pattern which is used for constructions such as “the week of April 11, 2016”. The English pattern that produces this is “the week of {0}”; the date format that replaces {0} is determined separately. Because the week-of patterns described here may appear in user interfaces that also show dates produced using the relative week period patterns, all of these patterns should be designed with consistent wording and structure.

Flexible - Timezone Append

timezone: {0} {1} 

See in Survey Tool.

The flexible append format for Timezone is used to compose a time and a timezone, to get a result like “11:30 Pacific Time”. 

Date/Time Intervals

Interval patterns contain a start pattern and an end pattern (using the Date/Time Symbols). They are used for a range of dates or times, such as “Sept 10–12” (meaning the 10th of September through the 12th of September). The interval format is used where it is necessary to make the pattern as short as possible, and elide information that does not have to be repeated. For example, the pattern used to get “Sept 10–12” in English is “MMM d–d”.

Unlike simple Date/Time Patterns, these consist of two parts, typically separated by with some kind of punctuation mark (e.g. English uses en-dash “ – “). Also, some fields in the second part are omitted (e.g. “d – d MMM” omits repeat of MMM for the second part). The first field that comes from the second date is marked with red in the examples below.

Interval Formatting

Format Pattern Date 1 Date 2 Result
MMM d– d 2008-09-13 2008-09-15 Sept 13–15
MMMM– MMMM , yyyy 2008-09-01 2008-11-31 September–November, 2008

Greatest Difference

Each combination of fields can be used with dates that differ by different amounts. For example, a format for the fields “yMMMd” (year, abbreviated month, and day) could be used with two dates that differ by year, month, or day.

As the examples below indicate, for a given skeleton, each type of difference might need a different pattern.

For example,

Date 1 Date 2 Greatest Difference Format Pattern Shares
2008-09-13 2009 -09-15 year (yMd) MMM d, yyyy – MMM d, yyyy nothing
2008-09-01 2008- 11 -31 month (Md) MMM d – MMM d, yyyy year
2008-09-01 2008-09- 05 day (d) MMM d– d , yyyy year and month

Different Calendars

Date and Time patterns are also available for other calendars in addition to the Gregorian calendar. For example, the Buddhist, Islamic, Hebrew, or Japanese calendars. 

Different calendars work with the data in Gregorian, and Generic in the following ways: