要设置链中日期和时间戳变量或输出的显示格式,您可以应用 解析日期/时间 转换,并将值设置为字符串格式时间 (strftime)。
<!--<ul> <li> Paste the raw transformation as the command property's value. </li> </ul>String format time
To use a Parse Date/Time transformation to set the format of a date or timestamp, enter its values as strftime.
-->日期值
| 值 | 范例 | strftime |
|---|---|---|
| 全天名称 | 星期日 |
%一个 |
| 日期缩写名称 | 太阳 |
%一个 |
| 星期几 | 0 到 6,其中星期日为 0 |
%w |
| 两位数年 | 21 |
%y |
| 四位数年 | 2021 |
%Y |
| 月份名称 | 1 月 |
%B |
| 月份缩写名称 | 一月 |
%b |
| 两位数月 | 01 至 12,一月至十二月 |
%m |
| 月份中的两位数日期 | 01 至 31 |
%d |
| 月份中的日期,不带前导零 | 1 至 31 |
%e |
您可以将这些值串联起来以设置日期格式。例如:
| 日期格式 | 范例 | strftime |
|---|---|---|
| mm/dd/yyyy | 12/01/2021 |
%m/%d/%Y |
| [完整的星期名称],[完整的月份名称] [日期(不含前导零)],[四位数的年份] | 2021年12月1日,星期三 |
%A、%B、%e、%Y |
| [月份缩写] [日期(不含前导零)] [日期缩写] | 12月1日星期三 |
%b %e %a |
时间值
| 值 | 范例 | strftime |
|---|---|---|
| 24小时制时钟的小时数 | 00 至 23 |
%H |
| 12小时制时钟的小时数 | 01 至 12 |
%我 |
| 12 小时制时钟,不带前导零的小时 | 1 至 12 |
%1 |
| 分钟 | 00 至 59 |
%M |
| 第二 | 00 至 60 |
%S |
| 前 或 后子午线 | 上午 或 下午 |
%p |
| 时区 | +08 |
%Z |
| 一年中的某一天 | 001 至 366 |
%m |
| 百分号 | % |
%% |
您可以将这些值串联起来设置时间格式。例如:
| 日期格式 | 范例 | strftime |
|---|---|---|
| 24 小时制 HH:MM | 23:01 |
%H:%M |
| 12 小时制 H:MM,带 前 或 后 | 4:31 PM |
%1:%M %p |
Raw transformations
Rather than apply a transformation to a variable or output used as a command property, you can copy and paste these raw transformations in the command property:
<h3>Timestamp</h3>For a full date and timestamp value, such as 2021-03-15T16:04:28.744118Z:
<pre>$(Chain.ExecutionDateTime)</pre> <h3>Time</h3>For the hour and minutes, such as 1610:
<pre>$(Chain.ExecutionDateTime)@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%H%MOC_ARGOC_ARGOC_ARG}</pre>For the hour, minutes, and seconds, such as 161051:
<pre>$(Chain.ExecutionDateTime)@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%H%M%SOC_ARGOC_ARGOC_ARG}</pre> <h3>Date</h3>With date values, the raw transformation can set the format for the current date or include subtractions to set previous years' values.
<h4>Current year</h4>For the current, four-digit year:
<pre>$(Chain.ExecutionDateTime)@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%YOC_ARGOC_ARGOC_ARG}</pre>For the current month and four-digit year:
<pre>$(Chain.ExecutionDateTime)@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%m%YOC_ARGOC_ARGOC_ARG}</pre>For the full current date, starting with the day, such as 31102021:
<pre>$(Chain.ExecutionDateTime)@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%d%m%YOC_ARGOC_ARGOC_ARG}</pre>For the full current date, starting with the month, such as 10312021:
<pre>$(Chain.ExecutionDateTime)@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%m%d%YOC_ARGOC_ARGOC_ARG}</pre> <h4>Previous year</h4>For the previous, four-digit year:
<pre>$(Chain.ExecutionDateTime)@transform{dateMathOC_SPLIT%FT%T.%fZOC_ARGsubtractOC_ARG1OC_ARGyearsOC_ARG}@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%YOC_ARGOC_ARGOC_ARG}</pre>For the current month a year ago:
<pre>$(Chain.ExecutionDateTime)@transform{dateMathOC_SPLIT%FT%T.%fZOC_ARGsubtractOC_ARG1OC_ARGyearsOC_ARG}@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%m%YOC_ARGOC_ARGOC_ARG}</pre>For the current date a year ago, starting with the day, such as 31102020:
<pre>$(Chain.ExecutionDateTime)@transform{dateMathOC_SPLIT%FT%T.%fZOC_ARGsubtractOC_ARG1OC_ARGyearsOC_ARG}@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%d%m%YOC_ARGOC_ARGOC_ARG}</pre>For the current date a year ago, starting with the month, such as 10312020:
<pre>$(Chain.ExecutionDateTime)@transform{dateMathOC_SPLIT%FT%T.%fZOC_ARGsubtractOC_ARG1OC_ARGyearsOC_ARG}@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%m%d%YOC_ARGOC_ARGOC_ARG}</pre> <h4>The year before last</h4>For the four-digit year, two years ago:
<pre>$(Chain.ExecutionDateTime)@transform{dateMathOC_SPLIT%FT%T.%fZOC_ARGsubtractOC_ARG2OC_ARGyearsOC_ARG}@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%YOC_ARGOC_ARGOC_ARG}</pre>For the current month two years ago:
<pre>$(Chain.ExecutionDateTime)@transform{dateMathOC_SPLIT%FT%T.%fZOC_ARGsubtractOC_ARG2OC_ARGyearsOC_ARG}@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%m%YOC_ARGOC_ARGOC_ARG}</pre>For the current date two years ago, starting with the day, such as 31102019:
<pre>$(Chain.ExecutionDateTime)@transform{dateMathOC_SPLIT%FT%T.%fZOC_ARGsubtractOC_ARG2OC_ARGyearsOC_ARG}@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%d%m%YOC_ARGOC_ARGOC_ARG}</pre>For the current date a year ago, starting with the month, such as 10312019:
<pre>$(Chain.ExecutionDateTime)@transform{dateMathOC_SPLIT%FT%T.%fZOC_ARGsubtractOC_ARG2OC_ARGyearsOC_ARG}@transform{parseDateTimeOC_SPLIT%FT%T.%fZOC_ARG%m%d%YOC_ARGOC_ARGOC_ARG}</pre> -->