convertTimeFormat (time)
  • 18 Oct 2024
  • Dark
    Light
  • PDF

convertTimeFormat (time)

  • Dark
    Light
  • PDF

Article summary

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

Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.