LastModifiedDate の表示方法が、Visualforce ページと Salesforce の標準画面で異なります。
Salesforce の標準画面 : 2011/03/31 15:35
Visulaforce: 2011-03-31 06:35:09
Salesforce の標準画面のように表示させるにはどのようにすればよいでしょうか。
クラス内で下記のように最終更新日を取得しフォーマットを変え myDate2 として定義します。
myDate1 / myDate2 は String 型の変数となります。
******************
List<CustomObject1__c> current_memo = new List<CustomObject1__c>();
current_memo = [SELECT LastModifiedDate FROM CustomObject1__c];
String myDate1 = current_memo[0].LastModifiedDate.format('yyyy/MM/dd HH:mm','JST');
String myDate2 = '更新日時:' + myDate1;
******************
上記で定義した値を、
<apex:outputLabel escape="false" value="{!myDate2}"></apex:outputLabel>
などのように表示することで、Visualforce ページ 上で、日本時間に即した形で日付/時間 を表示させることが可能です。
000385392

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.