# From Unix timestamp

## Description

This operation converts Unix timestamps into human-readable date and time formats. Unix timestamps represent the number of seconds (or milliseconds) that have elapsed since the Unix epoch, which began at 00:00:00 UTC on January 1, 1970.

***

## Data types

These are the input/output expected data types for this operation:

### Input data

![](https://965373739-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkxZeV4nlXcIAjMGZxzLI%2Fuploads%2FUKBjtsLJiNyyJqm6dJo6%2Fimage.png?alt=media\&token=b6067e4f-dbc1-4f38-8b82-6d734db332a9) - Integer values representing the Unix timestamps to be converted.

### Output data

![](https://965373739-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkxZeV4nlXcIAjMGZxzLI%2Fuploads%2FwTb2oTb0LEAHXBbhwEP9%2Fimage.png?alt=media\&token=9b224990-9f87-48b5-8995-5e7e62e71a79) - A string representing the formatted time.

***

## Parameters

These are the parameters you need to configure to use this operation (mandatory parameters are marked with a <mark style="color:red;">**\***</mark>):

<details>

<summary>Time Unit<mark style="color:red;"><strong>*</strong></mark></summary>

Specify the unit of time represented by the input timestamp. Choose one of the following:

* **Seconds**
* **Milliseconds**
* **Microseconds**
* **Nanoseconds**

</details>

<details>

<summary>Timezone Output</summary>

Specify the timezone of the input date strings. Enter one of the following:

* `UTC`
* `GMT`
* `PST`
* `PDT`
* `CET`
* `CEST`
* Any IANA time zone

If not provided, the default value is `UTC`.

</details>

<details>

<summary>Format Output</summary>

Specify the desired format of your output date strings. If not provided, the default format is `ddd d mmm yyyy hh:mm:ss timezone` (for example, `Mon 2 Jan 2006 15:04:05 MST`)

Note that you must use the following date to represent your required output format:

* **Date** - `January 02, 2006`
* **Time** - `15:04:05`

For example, imagine you have this input timestamp `978346800` and you want to get the corresponding date in this format: `ddd dd mmm yyyy hh:mm:ss`

You must enter the following in the **Format** **Output** parameter, considering the date above:

* `02 January 2006 15:04:05`

You will get this as your output date:

* `12 January 1970 07:45:46`

You can use any date format supported by [Go](https://go.dev/doc/). For a complete list of supported formats, check [this article](https://pkg.go.dev/time#pkg-constants).

These are some of the supported formats:&#x20;

* RFC3339 (for example `2006-01-02T15:04:05Z`)
* ANSIC (for example `Mon Jan 2 15:04:05 2006`)
* UnixDate (for example `Mon Jan 2 15:04:05 PST 2006`)
* Custom format (for example `02-01-2006 15:04:05`)

{% hint style="warning" %}
Note that custom formats must have day, month, year, and time. For example, this format `Mon Jan 2 15:04:05`won't work, as it is missing the year.
{% endhint %}

</details>

***

## Example

Suppose you want to convert a series of **timestamps** into **human-readable date strings**:

1. In your Pipeline, open the required [Action](https://docs.onum.com/the-workspace/pipelines/actions) configuration and select the input **Field**.
2. In the **Operation** field, choose **From Unix Timestamp**.
3. Set **Time Unit** to **Seconds**.
4. Set **Timezone Output** to `UTC`.
5. Set **Format Output** to `Mon 2 January 2006 15:04:05 UTC`
6. Give your **Output field** a name and click **Save**. The values in your input field will be transformed. For example:

```
Input data - 978346800

Time Unit - Seconds

Timezone Output - "UTC"

Format Output - "Mon 2 January 2006 15:04:05 UTC"

Output data - "Mon 1 January 2001 11:00:00 UTC"
```

{% hint style="info" %}
You can try out operations with specific values using the **Input** field above the operation. You can enter the value in the example above and check the result in the **Output** field.
{% endhint %}
