[threeten-dev] SimpleDateFormat and DateTimeFormatter produce different result for JapaneseDate
Frank Ding
dingxmin at linux.vnet.ibm.com
Wed May 1 23:22:24 PDT 2013
Hi Masayoshi
Sorry that I haven't made the issue clearer. The issue is what you
mentioned, " DateTimeFormatter doesn't support the text presentation of
the first year of an era".
Best regards,
Frank
On 4/30/2013 1:52 PM, Masayoshi Okutsu wrote:
> Hi,
>
> This one isn't reproducible with b87. Both SimpleDateFormat and
> DateTimeFormatter produce the era name in Japanese.
>
> BTW, SimpleDateFormat and DateTimeFormatter patterns aren't
> compatible. DateTimeFormatter doesn't support the text presentation of
> the first year of an era, for example.
>
> Thanks,
> Masayoshi
>
> On 4/27/2013 4:18 PM, Frank Ding wrote:
>> Hi threeten guys
>> Another issue was discovered in recent date time code (b87). Below
>> is the test case.
>>
>> Locale jplocale = new Locale("ja", "JP", "JP");
>> String str;
>> String pattern = "GGGGyyyy\u5e74 MMMM d\u65e5";
>>
>> System.out.println("--- Calendar SimpleDateFormst ---");
>> Calendar cal = Calendar.getInstance();
>> cal.set(1989,0,8); // = Heisei 1
>>
>> SimpleDateFormat format = new SimpleDateFormat(pattern,
>> jplocale);
>> str = format.format(cal.getTime());
>> System.out.println("\""+pattern+"\" "+str);
>>
>> System.out.println("--- JapaneseDate DateTimeFormatter ---");
>> JapaneseDate date = JapaneseDate.of(1989,1,8);
>> DateTimeFormatter dtf =
>> DateTimeFormatter.ofPattern(pattern).withLocale(jplocale);
>> str = date.format(dtf);
>> System.out.println("\""+pattern+"\" "+str);
>>
>> The actual output is (Converted Japanese characters to Unicode by
>> native2ascii command)
>> > --- Calendar SimpleDateFormst ---
>> > "GGGGyyyy\u5e74 MMMM d\u65e5" \u5e73\u6210\u5143\u5e74 1\u6708 8\u65e5
>> > --- JapaneseDate DateTimeFormatter ---
>> > "GGGGyyyy\u5e74 MMMM d\u65e5" Heisei0001\u5e74 1\u6708 8\u65e5
>>
>> It looks like a bug in DateTimeFormatter. Could anybody take a
>> look at it and confirm?
>>
>> Best regards,
>> Frank
>>
>>
>
More information about the threeten-dev
mailing list