[threeten-dev] DateTimeFormatter.withLocale question

Naoto Sato naoto.sato at oracle.com
Wed Feb 13 11:26:23 PST 2013


On 2/12/13 9:16 PM, Masayoshi Okutsu wrote:
> On 2/13/2013 7:38 AM, Stephen Colebourne wrote:
>> On 12 February 2013 22:34, Naoto Sato <naoto.sato at oracle.com> wrote:
>>> On 2/12/13 8:05 AM, Stephen Colebourne wrote:
>>>> DateFormat/SimpleDateFormat doesn't distinguish between the two
>>>> AFAICT,
>
> Traditionally DateFormat/SimpleDateFormat does. You have to set its
> NumberFormat to another one with a different numbering system, which is
> actually similar to the current DateTimeFormat design.
>
> As Naoto pointed out, you can specify different setting with a Locale
> value in JDK 8. For example, "en-u-ca-japanese-u-nu-thai" specifies to
> use the Japanese calendar with English date-time format patterns using
> the Thai digits (numbering system).

Just a nitpicking :-)

In this example, -u appears twice which is invalid (as a matter of fact, 
JDK's impl just ignores the latter -u, instead of throwing an 
exception), so in order to have the desired output, 
"en-u-ca-japanese-nu-thai" is the right BCP47 notation.

Naoto



More information about the threeten-dev mailing list