---
title: Utilities - DateTime
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/utils/utils-datetime
---

This page provides a comprehensive reference for utilities - datetime available in the workflow automation actions catalog. These actions enable you to date and time utilities.

## Convert an epoch to date/time [#utils-datetime-fromEpoch]

This action is used to transform from epoch timestamp to date/time. Possible references:

-   <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>
-   <https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html#SHORT_IDS>

Refer [fromEpoch](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html) for more information.

### Inputs

| Input             | Optionality | Type   | Description                                                                                                                                                                                                                                             |
| ----------------- | ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **timestamp**     | Required    | Int    | An integer representing epoch timestamp. **Note**: _UNIX epochs are the number of seconds after 1st Jan 1970, midnight UTC (00:00)_                                                                                                                     |
| **timestampUnit** | Optional    | string | A string representing unit of provided timestamp. Acceptable values: `SECONDS`, `MILLISECONDS(DEFAULT)`                                                                                                                                                 |
| **timezoneId**    | Optional    | String | A string representing timezone for desired date/time, default: UTC For more information on supported zoneIds refer: [ZoneId (Java Platform SE 8 )](https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html)                                     |
| **pattern**       | Optional    | String | A string representing pattern for desired datetime, default: `ISO-8601` For more information on supported patterns  refer: [DateTimeFormatter (Java Platform SE 8 )](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html) |
| **selectors**     | Optional    | List   | The selectors to get the only specified parameters as output.                                                                                                                                                                                           |

### Outputs

| Field            | Optionality | Datatype | Description                                          |
| ---------------- | ----------- | -------- | ---------------------------------------------------- |
| **date**         | Required    | String   | A string representation of date.                     |
| **time**         | Required    | String   | A string representation of time.                     |
| **datetime**     | Required    | String   | A string representation of datetime.                 |
| **timezone**     | Required    | Map      | A map representation of timezoneId and abbreviation. |
| **success**      |             | Boolean  | Status of the request                                |
| **errorMessage** |             | String   | Failure reason as message                            |

### Example

| Example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Workflow Input                                                                                                                                                                                                                                                                                                                                                                 | Outputs                                                                                                                                                                                          |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ```yaml name: from_epoch  workflowInputs:   timestamp:     type: Int   timestampUnit:     type: String   timezoneId:     type: String   pattern:     type: String  steps:   - name: epochTime     type: action     action: utils.datetime.fromEpoch     version: 1     inputs:       timestamp: ${{ .workflowInputs.timestamp }}       timezoneId: ${{ .workflowInputs.timezoneId }}       pattern: ${{ .workflowInputs.pattern }}       timestampUnit: ${{ .workflowInputs.timestampUnit }}       selectors:         - name: date           expression: ".date"         - name: time           expression: ".time"         - name: datetime           expression: ".datetime"         - name: timezone           expression: ".timezone" ``` | ```yaml mutation {   autoflowsStartWorkflowRun(     accountId: 11933347     definition: { name: "from_epoch" }     workflowInputs: [       {key: "timestamp", value: "1738236424003"}       {key: "timestampUnit", value: "MILLISECONDS"}       {key: "pattern", value: "yyyy-mm-dd HH:SS"}       {key: "timezoneId", value: "Asia/Kolkata"}       ]   ) {     runId   } } ``` | ```yaml {   "success": true   "date": "2025-01-30",   "time": "16:57:04.003"   "datetime": "2025-57-30 16:00",    "timezone": {     "abbreviation": "IST",      "id": "Asia/Kolkata"     } } ``` |
