# Date Operations

{% hint style="info" %}
See the changelog of this Action type [here](https://app.gitbook.com/s/IXj83By4f20oCrZZ0gyP/json-transformation).
{% endhint %}

## Overview

Perfrom a list of operations on date fields.

{% hint style="warning" %}
In order to configure this Action, you must first link it to a Listener. Go to [Building a Pipeline ](https://docs.onum.com/the-workspace/pipelines/building-a-pipeline)to learn how to link.
{% endhint %}

## Ports

These are the input and output ports of this Action:

<details>

<summary>Input ports</summary>

* **Default port** - All the events to be processed by this Action enter through this port.

</details>

<details>

<summary>Output ports</summary>

* **Default port** - Events are sent through this port if no error occurs while processing them.
* **Error port** - Events are sent through this port if an error occurs while processing them.

</details>

## Configuration

{% stepper %}
{% step %}
Find **Date Operations** in the **Actions** tab (under the **Transformation** group) and drag it onto the canvas.
{% endstep %}

{% step %}
To open the configuration, click the Action in the canvas and select **Configuration**.
{% endstep %}

{% step %}
Choose one of the available **Operations** and configure it as required:

<table><thead><tr><th width="173.21875">Operation</th><th>Parameter</th><th data-hidden></th></tr></thead><tbody><tr><td><strong>Add duration</strong></td><td><ul><li><strong>Timestamp</strong><mark style="color:red;"><strong>*</strong></mark> - Select the field from the Listener or Action that contains the timestamp value.</li><li><strong>Duration</strong><mark style="color:red;"><strong>*</strong></mark> - Select the field from the Listener or Action that contains the duration value.</li><li><strong>Unit</strong><mark style="color:red;"><strong>*</strong></mark> - Select the unit of measurement (milliseconds, seconds, minutes, hours, days) used to calculate the new date.</li><li><strong>Output field</strong><mark style="color:red;"><strong>*</strong></mark> - Give a name to the output field with this new value.</li></ul></td><td></td></tr><tr><td><strong>Subtract duration</strong></td><td><ul><li><strong>Timestamp</strong><mark style="color:red;"><strong>*</strong></mark> - Select the field from the Listener or Action that contains the timestamp value.</li><li><strong>Duration</strong><mark style="color:red;"><strong>*</strong></mark> - Select the field from the Listener or Action that contains the duration value.</li><li><strong>Unit</strong><mark style="color:red;"><strong>*</strong></mark> - Select the unit of measurement (milliseconds, seconds, minutes, hours, days) used to calculate the new date.</li><li><strong>Output field</strong><mark style="color:red;"><strong>*</strong></mark> - Give a name to the output field with this new value.</li></ul></td><td></td></tr><tr><td><strong>Timestamp difference</strong></td><td><ul><li><strong>Timestamp</strong><mark style="color:red;"><strong>*</strong></mark> - Select the field from the Listener or Action that contains the timestamp value.</li><li><strong>Timestamp 2</strong><mark style="color:red;"><strong>*</strong></mark> - Select the field from the Listener or Action that contains the timestamp to compare against.</li><li><strong>Result Unit</strong><mark style="color:red;"><strong>*</strong></mark> - Select the unit of measurement (milliseconds, seconds, minutes, hours, days) used to calculate the new date.</li><li><strong>Output field</strong><mark style="color:red;"><strong>*</strong></mark> - Give a name to the output field with this new value.</li></ul></td><td></td></tr></tbody></table>
{% endstep %}

{% step %}
Click **Save** to complete the process.
{% endstep %}
{% endstepper %}
