[threeten-dev] Possible addition of pattern letters in CLDR

yoshito_umaoka at us.ibm.com yoshito_umaoka at us.ibm.com
Thu Jan 10 12:45:49 PST 2013


I'm working on date format pattern letters on CLDR side. Below is the 
current status.

[Time Zone Patterns]

Design document: 
http://cldr.unicode.org/development/development-process/design-proposals/time-zone-offset-patterns

1) Letter 'X' - ISO 8601 difference between local time and UTC format, or 
UTC designator

CLDR TC agreed to add letter 'X'. This is mostly compatible with Java 7 + 
JSR-310 enhancement.

There are several minor differences from Java 7/JSR-310

Pattern "X" is used for 'shortest' ISO 8601 'difference between local time 
and UTC' basic format, or "Z" when offset is 0. This is slightly different 
from the current Java SimpleDateFormat/JSR-310 specification in next two 
cases.

- Minutes field might be appended when the field is not 0 - for example, 
"+0530".
- "Z" (UTC designator) is used when both offset hours and minutes are 0, 
even seconds field is not 0. So it will never return "+00" or "-00".

Pattern "XX" and "XXX" is used for ISO 8601 'difference between local time 
and UTC' format ("XX" basic format / "XXX" extended format) including 
minutes, or "Z" when offset is 0. These are also slightly different from 
the current Java SimpleDateFormat.

- "Z" (UTC designator) is used when both offset hours and minutes are 0, 
even seconds field is not 0. So it will never return "+0000", "-0000", 
"+00:00".

Pattern "XXXX" and "XXXXX" is used for ISO 8601 'difference between local 
time and UTC' style format, or "Z" when offset is 0. These are equivalent 
to the patterns currently defined in JSR-310 
javax.time.format.DateFormatters. Note that the format including offset 
seconds is illegal in ISO 8601. "XXXX" or "XXXXX" might be only used when 
time zone offset must be preserved including non zero seconds field.


2) Letter 'x' - ISO 8601 difference between local time and UTC format

CLDR TC agreed to add letter 'x' in parallel to 'X' above. This is not 
available in Java 7 / JSR-310. The design goal of the 'x' patterns is to 
provide ISO 8601 difference between local time and UTC format, without 
special case "Z" (UTC designator).

- Pattern 'xx' is equivalent to "Z" and "ZZ" in Java, "Z"/"ZZ"/"ZZZ" in 
the current LDML specification
- Pattern 'xxx' is equivalent to "ZZZ" or longer in Java.



3) Letter 'O' - Localized GMT format

This is also accepted. 'O' patterns are used for LDML's "localized GMT 
format". "O" is used for short format and "OOOO" is used for long format 
(equivalent to "ZZZZ" in the current LDML specification). This format is 
similar to GMTOffsetTimeZone format in Java's SimpleDateFormat, but 
message pattern, field separator and digits can be localized.


4) Time Zone Identifier

I proposed letter 'I' that is compatible with the current JSR-310 
specification, but I got some comments against this.

- Do not want to waste a new pattern letter just for this. This pattern 
probably does not need any variants ("II", "III"...)
- I is easily confused with l

I was suggested to look for other patterns without a new letter. There are 
some candidates in my mind - "zzzzz" (Cons: collision with Java 
SimpleDateFormat), "V" (Cons: LDML spec backward compatibility problem - 
although the patter is technically deprecated), "VV" (Cons: looks awkward 
in Java, without supporting "V"). We may still end up to "I", but need 
some more discussion in CLDR TC.


[Fractional Seconds]

I created a new CLDR ticket [http://unicode.org/cldr/trac/ticket/5556]. We 
discussed about this briefly, but I need a little bit more investigation 
for a couple of things - 1) whether if we need to consider 0 as the length 
of minimum decimal fractions.  2) backward compatibility problem - letter 
'#' is not reserved for the current syntax, although it is unlikely used 
practically.


[Nano Seconds]

'n' and 'N' are not discussed in the CLDR TC yet.



I'm a little bit worrying about 'X' and 'x'. If you have any comments, 
please let me know. At this point, if I did not get any pushbacks from 
JSR-310 community, 'X' / 'x' / 'O' will be added to LDMLR specification 
for CLDR 23 release (March).

Thanks,
Yoshito


More information about the threeten-dev mailing list