Visualforce で 和暦、年号等を実装するにはどのように実装すればよいですか?
Account オブジェクト上に、RegistrationDate__c というカスタム項目を作成します。
項目タイプは、Date 型 とします。
サンプルコード
DateTime 型の時は、下部の記述 (一旦DATEVALUE() 関数で変換) で動作します。
下記コードには、RegistrationDate__c にどのようにデータが格納されているかを確認するため、表示用のコードが記載されています。
実装時には、不要なコードと HTML タグは削除してください。
****************
<apex:page StandardController="Account">
<apex:outputText value="{0,number,令和##}年{1,date,MM}月{1,date,dd}日" escape="false" rendered="{!account.RegistrationDate__c >= DATEVALUE('2019-05-01')}">
<apex:param value="{!YEAR(account.RegistrationDate__c)-2019+1}" />
<apex:param value="{!account.RegistrationDate__c}" />
</apex:outputText>
<apex:outputText value="{0,number,平成##}年{1,date,MM}月{1,date,dd}日" escape="false" rendered="{!AND(account.RegistrationDate__c >= DATEVALUE('1989-01-08'), account.RegistrationDate__c < DATEVALUE('2019-05-01'))}">
<apex:param value="{!YEAR(account.RegistrationDate__c)-1989+1}" />
<apex:param value="{!account.RegistrationDate__c}" />
</apex:outputText>
<apex:outputText value="{0,number,昭和##}年{1,date,MM}月{1,date,dd}日" escape="false" rendered="{!account.RegistrationDate__c < DATEVALUE('1989-01-08')}">
<apex:param value="{!YEAR(account.RegistrationDate__c)-1926+1}" />
<apex:param value="{!account.RegistrationDate__c}" />
</apex:outputText>
<br />
<apex:outputText value="{!account.RegistrationDate__c}">
</apex:outputText>
<br />
</apex:page>
****************
結果
------
令和1年05月01日
Wed May 01 00:00:00 GMT 2019
------
000384454

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.