[salesforce]「日付/時間型」項目を和暦の午前・午後表示に
数式を使って、日付/時間型項目を和暦午前午後表示にする方法。
仮に「Field1」が日付/時間型のフィールドとして、
[php]
IF( ISNULL( Field1__c ) ,null ,
"平成" &
TEXT(YEAR(DATEVALUE( Field1__c ) ) -1988) & "年" &
TEXT(MONTH(DATEVALUE( Field1__c ) ) ) & "月" &
TEXT(DAY(DATEVALUE( Field1__c ) ) ) & "日" &
IF((VALUE(MID(TEXT( Field1__c ) ,12 , 2 ) ) + 9) >= 24,
" " &"午前"&
TEXT( VALUE ( MID ( TEXT ( Field1__c ) ,12 , 2 ) ) + 9 -24 ) & "時"
,
IF((VALUE ( MID ( TEXT ( Field1__c ) ,12 , 2 ) ) + 9) >= 13,
" " &"午後"&
TEXT( VALUE ( MID ( TEXT ( Field1__c ) ,12 , 2 ) ) + 9 -12 ) & "時"
,
IF((VALUE ( MID ( TEXT ( Field1__c ) ,12 , 2 ) ) + 9) = 12,
" " &"午後"&
TEXT( VALUE ( MID ( TEXT ( Field1__c ) ,12 , 2 ) ) + 9 ) & "時"
,
IF((VALUE ( MID ( TEXT ( Field1__c ) ,12 , 2 ) ) + 9) >= 10,
" "&"午前"&
TEXT( VALUE ( MID ( TEXT ( Field1__c ) ,12 , 2 ) ) + 9 ) & "時"
,""
)
)
)
)
&
TEXT( VALUE ( MID ( TEXT ( Field1__c ) ,15 , 2 ) ) )& "分"
)
[/php]