Task References

On this page:

convertTimeFormat (time)

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

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 momentjs documentation.


Outgoing Type Description
convertedTime Object The converted time value. Presented in the format specified by the newFormatString parameter.

Examples

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.

    convertTimeFormat01

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.

    convertTimeFormat01