0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Salesforce】テキスト型の日時情報から日付/時間の数式を作成する方法

Posted at

日付と時間が別々のテキスト型としてあるときに、それらを結合して時差も考慮した日付/時間の数式を作成してみました。

前提

  • yyyyMMddとして入るテキスト型項目(testdate__c)
  • hhmmssとして入るテキスト型項目(testtime__c)
  • 値は日本標準時
    image.png

作成方法

戻り値が日付/時間の数式項目を下記の数式を参考に作成します。
値を日付/時間のフォーマットに合うように加工してあげます。
加工しただけだと時差分ずれてしまうので、最後の「- (9/24)」で修正しています。

DATETIMEVALUE(
    LEFT(testdate__c, 4) & "-" & MID(testdate__c,5,2) & "-" & RIGHT(testdate__c,2)
    & " "
    & LEFT(testtime__c, 2) & ":" & MID(testtime__c,3,2) & ":" & RIGHT(testtime__c,2)
) - (9/24)

時差を考慮した日付/時間の数式項目が作成できました。
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?