# Format date transform function

## Introduction

The **format** transform function is used to change a date value to a different format. For example:

{% code title=" ISO 8601 format" %}

```json
"created_at":"2023-10-26T07:51:07-04:00"
```

{% endcode %}

&#x20;...might be changed to:

{% code title="Unix Epoch format" %}

```json
1698321067
```

{% endcode %}

A range of predefined date formats is available for selection, or you can set your own [custom format](#custom-dates-common-format-specifiers).&#x20;

## Adding a format date transform

**Step 1**\
In your process flow, access settings for your map shape:

<div align="left"><figure><img src="/files/uOOcqIQ6tnqg9qPI2fBE" alt="" width="290"><figcaption></figcaption></figure></div>

**Step 2**\
Select the **add transform** button for the required mapping rule - for example:

<div align="left"><figure><img src="/files/ClwLRaetWFvEHIB8g8TM" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 3**\
Click the **add transform** button:

<div align="left"><figure><img src="/files/WK4c9L3KxE8RNOrxtiQ0" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 4**\
Click in the **name** field to access a list of all available transform functions, then select **format** from the **date** category:

<div align="left"><figure><img src="/files/hSldTaB00ytLlWyh900D" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 5**\
Click in the **format** field to select a predefined date format that incoming dates should be converted to:

<div align="left"><figure><img src="/files/yz9aJgVyrzHCtqxdPofW" alt="" width="375"><figcaption></figcaption></figure></div>

<details>

<summary><img src="/files/mjTTZzyEQN7pfYDU3Ixl" alt="" data-size="line"> The format that I need isn't listed</summary>

If the format that you need isn't listed, choose the `custom` option from the `format` list, then specify the required format in the `custom format` field - for example: j.m.Y

![](/files/JQ31JoZ4uOls30xpz45n)

For a list of commonly used date specifiers that can be used in custom formats, see [below](#custom-dates-common-format-specifiers).

</details>

**Step 6**\
Click the **add field** button:

<div align="left"><figure><img src="/files/DuWdQoilGrRqPUEPq9K9" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 7**\
Click in **source fields** and select the source field to be used for this transform:

<div align="left"><figure><img src="/files/dzECLkLzYMHSktVuo8z0" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 8**\
Accept your changes (twice).

**Step 9**\
Save the transform. You'll notice that the transform icon is updated to indicate that a transform function is present for the mapping row - for example:

<div align="left"><figure><img src="/files/ZVMGB4EezEZE5PNZp0LY" alt="" width="375"><figcaption></figcaption></figure></div>

## Common format specifiers for custom dates

Internally, the format transform function uses Laravel's date format methods, which in turn call PHP date format methods. Commonly used format specifiers are listed below - full details are available in [this Laravel guide](https://www.php.net/manual/en/datetime.format.php).

### **Day-related**&#x20;

The following characters are commonly used to specify **days** in custom format dates.

<table><thead><tr><th width="141">Specifier</th><th>Summary</th></tr></thead><tbody><tr><td>d</td><td>Day of the month with leading zeros (01 to 31).</td></tr><tr><td>j</td><td>Day of the month without leading zeros (1 to 31).</td></tr><tr><td>D</td><td>A textual representation of a day in three letters (Mon to Sun)</td></tr><tr><td>l</td><td>A full textual representation of the day of the week (Monday to Sunday)</td></tr></tbody></table>

### **Month-related**&#x20;

The following characters are commonly used to specify **months** in custom format dates.

<table><thead><tr><th width="141">Specifier</th><th>Summary</th></tr></thead><tbody><tr><td>m</td><td> Numeric representation of a month with leading zeros (01 to 12).</td></tr><tr><td>n</td><td> Numeric representation of a month without leading zeros (1 to 12).</td></tr><tr><td>M</td><td> A textual representation of a month in three letters (Jan to Dec)</td></tr><tr><td>F</td><td> A full textual representation of a month (January to December).</td></tr></tbody></table>

### **Year-related**&#x20;

The following characters are commonly used to specify **years** in custom format dates.

<table><thead><tr><th width="141">Specifier</th><th>Summary</th></tr></thead><tbody><tr><td>Y</td><td>Four-digit representation of the year (e.g. 2023).</td></tr><tr><td>y</td><td>Two-digit representation of the year (e.g. 23).</td></tr></tbody></table>

### **Time-related**&#x20;

The following characters are commonly used to specify **times** in custom format dates.

<table><thead><tr><th width="141">Specifier</th><th>Summary</th></tr></thead><tbody><tr><td>H</td><td>Hour in 24-hour format with leading zeros (00 to 23).</td></tr><tr><td>i</td><td>Minutes with leading zeros (00 to 59).</td></tr><tr><td>s</td><td>Seconds with leading zeros (00 to 59).</td></tr><tr><td>a</td><td>Lowercase Ante meridiem (am) or Post meridiem (pm).</td></tr><tr><td>A</td><td>Uppercase Ante meridiem (AM) or Post meridiem (PM).</td></tr></tbody></table>

## Usage notes

### Unix Epoch format

Unix Epoch dates must be received as a number, not a string - i.e.:

`1701734400` rather than `"1701734400"`

If your Unix dates are provided as strings, you should convert these to numbers. To achieve this, add a [cast to number](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations/available-transform-functions/string-transform-functions/cast-to-number-transform-function.md) transform for the date field BEFORE the date format transform function.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations/available-transform-functions/date-transform-functions/format-date-transform-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
