convertTimeToEpoch

The convertTimeToEpoch task converts a date/timestamp to Epoch Time — the number of seconds (or milliseconds) elapsed since January 1, 1970 (midnight UTC/GMT).

Potential use case

Use this task when a workflow needs to provide an input timestamp to a downstream interface or system that requires Epoch Time format.

Properties

IncomingTypeDescription
inputTimeObjectRequired. The date/timestamp to convert.
EpochFormatEnumRequired. The Epoch format for the output. Allowed values: "Seconds" or "Milliseconds".
OutgoingTypeDescription
epochTimeNumberThe converted date/timestamp value as seconds or milliseconds since January 1, 1970 (midnight UTC/GMT), as specified by EpochFormat.

Example 1

In this example:

  • The inputTime variable comes from the getTime reference task. The reference variable is time.
  • The EpochFormat is set to Seconds.
  • The output epochTime will be the inputTime value expressed in seconds since January 1, 1970.
convertTimeToEpoch task with inputTime from getTime and EpochFormat set to Seconds

Example 2

In this example:

  • The inputTime variable comes from the getTime reference task. The reference variable is time.
  • The EpochFormat is set to Milliseconds.
  • The output epochTime will be the inputTime value expressed in milliseconds since January 1, 1970.
convertTimeToEpoch task with inputTime from getTime and EpochFormat set to Milliseconds

Manual reference variable entry

To enter the inputTime object manually, use the Year-Month-Date-Time format (yyyy-MM-dd 'T' HH:mm:ss.SSSZ):

1{"time": "2021-02-26T15:00:00.000Z"}

This displays as:

2021-02-25 03:00.00