> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# convertEpochToObject

> Use the convertEpochToObject task to convert an Epoch timestamp into a human-readable date string with a specified time and date format.

The `convertEpochToObject` task converts an Epoch timestamp into a date string with a specified time and date format.

### Potential use case

Suppose 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 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](https://momentjs.com/docs/#/displaying/format/) 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 example:

* The `epoch` variable is provided by the output of the reference task `convertTimeToEpoch`, which is located elsewhere in the workflow.

  The `convertTimeToEpoch` task was used only to simulate an incoming Epoch timestamp for this example.

* The reference variable provided by the `convertTimeToEpoch` task is `epochTime`.

* The `EpochFormat` variable is set to `Seconds`.

* The `newFormatString` variable is set to `LLL`, which is the moment.js [locale format](https://momentjs.com/docs/#/displaying/format/) for **Month name, day of month, year, time**.

* The `convertedTime` produced upon output will be the value of the `epoch` timestamp presented in a human-readable format.

![](/_fern-img/082edf137e6310b96b00a71a8037f76495ac5ef4f87df7e3e0c9d0c34e1f1830.webp)

## Example 2

In this example:

* The `epoch` variable is provided by the output of the reference task `convertTimeToEpoch`, which is located elsewhere in the workflow.

  The `convertTimeToEpoch` task was used only to simulate an incoming Epoch timestamp for this example.

* The reference variable provided by the `convertTimeToEpoch` task is `epochTime`.

* The `EpochFormat` variable is set to `Seconds`.

* The `newFormatString` property is set to `DD-MMM-YY hh:mm a`, which is a [date time format](https://momentjs.com/docs/#/displaying/format/) for **Day-Month-Year hour:min am/pm**.

* The `convertedTime` produced upon output will be the value of the `epoch` timestamp presented in a human-readable format.

![](/_fern-img/df79b3e04a11a497b94370b8d1140fc67407a8386f5384d93d07047dc78216b6.webp)

## Example 3

In this example:

* The `epoch` property is statically set to the number `1591045860`.
* The `EpochFormat` property is set to `Seconds`.
* The `newFormatString` property is set to `DD-MMM-YY hh:mm a`, which is a [date time format](https://momentjs.com/docs/#/displaying/format/) for **Day-Month-Year hour:min am/pm**.
* The `convertedTime` produced upon output will be the value of the `epoch` timestamp presented in a human-readable format. In this case the converted timestamp will be `01-Jun-20 09:11 pm`.

![](/_fern-img/34876494495d46dc64782ad2d51ed0ed6346fe982d490e99e0949ece1b5feb06.webp)