【Zoho People】数式項目:生年月日を和暦で表示

【Zoho People】数式項目:生年月日を和暦で表示

以下の数式を設定することで、和暦での日付表示が可能です。
  1. If(DateDiff(Date_of_birth,NewDateTime(2019,4,30,0,0,0),'Hour')>0,Concat('令和',If((GetYears(Date_of_birth)-2019)==0,'元',ToString(GetYears(Date_of_birth)-2018)),'年',ToString(GetMonths(Date_of_birth)),'月',ToString(GetDays(Date_of_birth)),'日'),If(DateDiff(Date_of_birth,NewDateTime(1989,1,7,0,0,0),'Hour')>0,Concat('平成',If((GetYears(Date_of_birth)-1989)==0,'元',ToString(GetYears(Date_of_birth)-1988)),'年',ToString(GetMonths(Date_of_birth)),'月',ToString(GetDays(Date_of_birth)),'日'),If(DateDiff(Date_of_birth,NewDateTime(1926,12,25,0,0,0),'Hour')>0,Concat('昭和',If((GetYears(Date_of_birth)-1926)==0,'元',ToString(GetYears(Date_of_birth)-1925)),'年',ToString(GetMonths(Date_of_birth)),'月',ToString(GetDays(Date_of_birth)),'日'),If(DateDiff(Date_of_birth,NewDateTime(1912,7,30,0,0,0),'Hour')>0,Concat('大正',If((GetYears(Date_of_birth)-1912)==0,'元',ToString(GetYears(Date_of_birth)-1911)),'年',ToString(GetMonths(Date_of_birth)),'月',ToString(GetDays(Date_of_birth)),'日'),If(DateDiff(Date_of_birth,NewDateTime(1868,1,24,0,0,0),'Hour')>0,Concat('明治',If((GetYears(Date_of_birth)-1868)==0,'元',ToString(GetYears(Date_of_birth)-1867)),'年',ToString(GetMonths(Date_of_birth)),'月',ToString(GetDays(Date_of_birth)),'日'),'明治より前')))))
Notes
上記では、生年月日項目のラベル名が「Date_of_birth」であることを前提としています。
もし異なる場合は、「Date_of_birth」の部分を該当のラベル名に置き換えてください。
明治より前の元号については対応していません(数式の内容の追加により対応可能です)。