Pages

Monday, January 25, 2016

Episode 467: Certificate Issue Date on Auto-generated PDF in Japanese Era Name

'Date in Japanese calendar!'

"Representation of years" is complicated in Japan. That is, We do not say "year 2016" at the governmental procedure or at schools. This year is absolutely "Heisei 27". The date is represented in "Japanese calendar" in documents which have a little bit of importance, such as "Residence certificate", "Family registration", or "Graduation diploma"...

However, in reality,,, only a few Japanese can immediately answer that "this year is Heisei 28!"

Even so, this "mechanism of resetting to the first year (year 1), once in several decades" is continued already 1400 years or more. It is too much significant for the government of the time to abolish... (And, on the day the current emperor died, another new "era name" will be published.)


The following is a flow of "Employment certification" issuance.

It has devised that at an upstream Step, the employee's 'name' and "birth date' are entered, and the a certificate PDF is automatically generated at [Auto-step] in the middle of the flow. Notably, date data such as "date of birth" and "certificate issue date" is automatically converted to the Japanese calendar. It could be diverted also to issuance flow for, for example, "Graduation certificate" or "PTA News", etc.

[Certificate Issuance]



Compatibility between the "perspective of data management" and "perspective of description in Japanese calendar" is not good.

In this example, display upon inputting is in Gregorian calendar when the 'Date of birth' is entered by calendar input. Even if it is connected to Employee database, etc., date of birth is stored as Gregorian calendar. In fact, at the desks of clerical work in Japan, there is an "Age chart table" for converting the year of birth from Gregorian calendar to Japanese one to convert manually. Yet, it is very time-consuming and mistakes frequently occur.


By placing this [Script Step], you will no longer need the calendar conversion Chart.

Incidentally, the data of 1989-01-07 is displayed as 'January 7th, Showa 64', and 1989-01-08 is shown as 'January 8th, Heisei first year'. That is, the day of "changing the name of era" is also judged automatically. (It is Showa 64 until January 7th, but on and after January 8th of the same year, it is Heisei first year.) Similarly, "Showa" and "Taisho" is also automatically converted on the basis of the date. (It is becoming doesn't matter nowadays because people who were born in Heisei is increasing.)
  • 1900-01-01: January 1st, Meiji 33
  • 1912-07-29: July 29th, Meiji 45
  • 1912-07-30: July 30th, Taisho first year
  • 1926-12-24: December 24th, Taisho 15
  • 1926-12-25: December 25th, Showa first year
  • 1989-01-07: January 7th, Showa 64
  • 1989-01-08: January 8th Heisei first year

By the way, in the cloud-based workflow "Questetra BPM Suite", "date data of earlier than January 1, 1900" can not be treated as the date type (system constraints). That means, it cannot neither manage date data of "Meiji first year" nor convert it to Japanese calendar.

However, because lunisolar calendar had been adopted in Japan until 1872 (Meiji 5), so to manage date data of before that in Gregorian calendar doesn't make sense. For example, "the basic policy of Meiji government" (regime manual) has been promulgated on "April 21th Keio 4" (leap month) immediately after the bloodless surrender of Edo Castle. And it is nonsense to manage it as "June 11th, 1868".

[Certificate Issuance:"1. Content of Certification" screen]

Setting of Script Step "Japanese calendar conversion" (Server Side JavaScript)
//// == Retrieving == 
var birthDate = data.get( "4" ); 
var hireDate = data.get( "7" ); 
var issueDate = data.get( "12" ); 

//// == Calculating == 
var locale = new java.util.Locale( "ja", "JP", "JP" ); 
// Language code, Country code, Variant code 
// Date after 1900 is displayed in Japanese calender by Variant "JP" 
var japanFormat = new java.text.SimpleDateFormat( "GGGGyyyy年M月d日", locale ); 
// 1 to 3 "G"s: Display by Initial letter alphabet e.g. "H", "S" 
// 4 "G" s: Displayed in isplayed in kanji, e.g. "平成", "昭和" 
// 4 "y"s: Display first year as "元年" 

birthDateJa = japanFormat.format( birthDate.getTime() ); 
hireDateJa = japanFormat.format( hireDate.getTime() ); 
issueDateJa = japanFormat.format( issueDate.getTime() ); 

//// == Updating == 
retVal.put( "5", birthDateJa ); 
retVal.put( "8", hireDateJa ); 
retVal.put( "13", issueDateJa ); 

[Data Items list]

[Free Download]
<Similar Models>
<<Related Articles>>

[Japanese Entry (和文記事)]