- 02 May 2024
-
DarkLight
-
PDF
convertEpochToObject (time)
- Updated on 02 May 2024
-
DarkLight
-
PDF
Task Purpose
The convertEpochToObject task converts an Epoch timestamp into a date string with a specified time/date format.
Potential Use Case
Let's say you have a northbound system that is only capable of providing an Epoch timestamp. The convertEpochToObject task allows you to convert it into a human-readable timestamp for log files or other event records.
Properties
Input and output properties are shown below.
Input Variables
Incoming | Type | Description | Example |
---|---|---|---|
epoch |
Number | Required. The Epoch timestamp to convert. Epoch timestamps are defined as the number of seconds or milliseconds that have elapsed since midnight UTC on January 1st, 1970. | 1688050800 |
epochFormat |
Enum | Required. The format of the epoch timestamp value. Allowed values are Seconds or Milliseconds . |
Seconds |
newFormatString |
String | Optional. The moment.js format of the converted epoch value. |
YYYY-MM-DDTHH:mm:ss.SSSSSSZZ |
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
epoch
variable is provided by the output of the reference taskconvertTimeToEpoch
, which is located located elsewhere in the workflow.Note: The
convertTimeToEpoch
task was used only to simulate an incoming Epoch timestamp for this example. -
The reference variable provided by the
convertTimeToEpoch
task isepochTime
. -
The
EpochFormat
variable is set toSeconds
. -
The
newFormatString
variable is set toLLL
, which is the momentum.js locale format for Month name, day of month, year, time. -
For this example, the
convertedTime
produced upon output will be the value of theepoch
timestamp presented in a human-readable format.
Example 2
In this IAP example:
-
The
epoch
variable is provided by the output of the reference taskconvertTimeToEpoch
, which is located located elsewhere in the workflow.Note: The
convertTimeToEpoch
task was used only to simulate an incoming Epoch timestamp for this example. -
The reference variable provided by the
convertTimeToEpoch
task isepochTime
. -
The
EpochFormat
variable is set toSeconds
. -
The
newFormatString
property is set toDD-MMM-YY hh:mm a
, which is a date time format for Day-Month-Year hour:min am/pm. -
For this example, the
convertedTime
produced upon output will be the value of theepoch
timestamp presented in a human-readable format.
Example 3
In this IAP example:
-
The
epoch
property is statically set to the number1591045860
. -
The
EpochFormat
property is set toSeconds
. -
The
newFormatString
property is set toDD-MMM-YY hh:mm a
, which is a date time format for Day-Month-Year hour:min am/pm. -
For this example, the
convertedTime
produced upon output will be the value of theepoch
timestamp presented in a human-readable format. In this case the converted timestamp will be01-Jun-20 09:11 pm
.