convertTimeFormat (time)
  • Dark
    Light
  • PDF

convertTimeFormat (time)

  • Dark
    Light
  • 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.

Incoming Type Description
inputTime Object Required. The date/timestamp to convert.
newFormatString String Required. Represents the format by which the time should be displayed. Accepts formats identified in the moment.js documentation.


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 of getTime, which is a reference task located elsewhere in the workflow. The reference variable provided by the getTime task is time.

  • The newFormatString property is set to gg, 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 the inputTime value exists.

    convertTimeFormat-ex01

Example 2

In this IAP example:

  • The inputTime property is provided by the output of getTime, which is a reference task located elsewhere in the workflow. The reference variable provided by the getTime task is time.

  • The newFormatString property is set to Qo, 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 the inputTime value exists. With this example, if the inputTime value is February 12, then the resulting convertedTime value will be "2nd" Quarter.

    convertTimeFormat-ex02


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