- 06 Jul 2023
-
DarkLight
-
PDF
convertTimeFormat (time)
- Updated on 06 Jul 2023
-
DarkLight
-
PDF
convertTimeFormat Task Purpose
The convertTimeFormat task converts a time value into a new format.
Potential Use Case
Use this task if a workflow that you designed requires you to take a specific record timestamp and convert it a different time/date format, such as the 'quarter' of the year, or you specifically need it to provide only the day of the year from a given date.
Properties
Input and output properties are shown below.
Input Variables
Incoming | Type | Description | Example |
---|---|---|---|
inputTime |
Object | Required. The timestamp to be converted. Presented as a moment.js formatted string. The timestamp must be provided as a value of the time key; see the provided example. |
{ "time": "2023-04-28T01:21:14.052000-1100" } |
newFormatString |
String | Required. The format of the converted timestamp. | gg |
Output Variables
Outgoing | Type | Description |
---|---|---|
convertedTime |
Object | The converted time value. Presented in the format specified by the newFormatString parameter. |
Example 1
In this IAP example:
-
The
inputTime
property is provided by the output ofgetTime
, which is a reference task located elsewhere in the workflow. The reference variable provided by thegetTime
task istime
. -
The
newFormatString
property is set togg
, which is the momentum.js locale 2 digit format for Week Year (1-52). -
For this example, the
convertedTime
will be the week number of the year in which theinputTime
value exists.
Example 2
In this IAP example:
-
The
inputTime
property is provided by the output ofgetTime
, which is a reference task located elsewhere in the workflow. The reference variable provided by thegetTime
task istime
. -
The
newFormatString
property is set toQo
, which is the momentum.js format for Quarter. This format includes a trailing numeral abbreviation such as "1st, 2nd, 3rd, or 4th". -
The
convertedTime
will be the quarter number for the calendar year in which theinputTime
value exists. With this example, if theinputTime
value is February 12, then the resultingconvertedTime
value will be "2nd" Quarter.
Manual Reference Variable Entry (inputTime)
To enter the inputTime
object manually, use the format below for Year-Month-Date-Time ("yyyy-MM-dd 'T' HH:mm:ss.SSSZ").
{"time": "2021-02-26T15:00:00.000Z"}
This format shows as:
2021-02-25 03:00.00