Support Article
FormatDateTime ignores the name of Japanese Era
SA-64372
Summary
Java Calendar class supports the local calendar such as Japanese Imperial Calendar or Thai Buddhist Calendar.
Using the Rule Utility Function (RUF) FormatDateTime, specify ja_JP_JP locale instead of standard ja_JP. This displays the Japanese Calendar year number correctly (for example, 30 for AD2018). However, it ignores the name of Era (such as 平成 (Heisei)) text string.

Note: Japanese Era must display as 'JapaneseEra Custom'.
Error Messages
Not Applicable
Steps to Reproduce
Create a declare expression or a data transform to set the text string using FormatDateTime RUF: @FormatDateTime(".CommonEra","GGGGy年M月d日","Asia/Tokyo","ja_JP_JP").
The date is not formatted and is displayed as 30年8月3日. The date must display as 平成30年8月3日.
Root Cause
This issue was determined to be a product enhancement request.
Resolution
An enhancement request, FDBK-28141, is created for consideration by Pega Product Management.
Perform the following local-change:
1. Create a custom function (JapanDate) to update the Japanese Era.
Locale locale = new Locale(strLocale);
DateFormat jp = new SimpleDateFormat(strPattern,locale);
Date date=new Date();
try{
DateFormat pega=new SimpleDateFormat("yyyyMMdd",new Locale("en","US")); date=pega.parse(strDateTime);
} catch (java.text.ParseException e) {
}
return jp.format(date); 2. Use JapanDate function instead of FormatDateTime as below.
@JapanDate(".CommonEra","GGGGy年M月d日","Asia/Tokyo","ja_JP_JP")
Published September 11, 2018 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.