1
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

今回はSalesforceで「作成日」を秒数まで表示する数式項目作成方法をご紹介します。
通常であれば作成日項目は
2021/12/08 17:35
のように分単位しか表示されません。

何秒まで を表示させるには、数式項目(項目型:テキスト)を作成する必要があります。

数式は下記となります

TEXT(YEAR(DATEVALUE( CreatedDate ))) + "/" + LPAD(TEXT(MONTH(DATEVALUE(CreatedDate))), 2, "0") + "/" + LPAD(TEXT(DAY(DATEVALUE(CreatedDate))), 2, "0") + " " + LPAD(TEXT(HOUR(TIMEVALUE(CreatedDate ))+ 9), 2, "0") + ":" + LPAD(TEXT(MINUTE(TIMEVALUE(CreatedDate))), 2, "0") + ":" + LPAD(TEXT(SECOND(TIMEVALUE(CreatedDate))), 2, "0")

なお、上記数式は日本時間の時間差を考慮したもの(つまり+9時間 をしたもの)
です。

時間差を考慮しなければ下記となります

TEXT(YEAR(DATEVALUE( CreatedDate ))) + "/" +
LPAD(TEXT(MONTH(DATEVALUE(CreatedDate))), 2, "0") + "/" +
LPAD(TEXT(DAY(DATEVALUE(CreatedDate))), 2, "0") +
" " +
LPAD(TEXT(HOUR(TIMEVALUE(CreatedDate))), 2, "0") + ":" +
LPAD(TEXT(MINUTE(TIMEVALUE(CreatedDate))), 2, "0") + ":" +
LPAD(TEXT(SECOND(TIMEVALUE(CreatedDate))), 2, "0")

1
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
1
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?